Reorganise assertions so they are not expecting a specific order from the DataList

This commit is contained in:
Robbie Averill 2018-08-14 15:08:03 +12:00
parent 8428df1502
commit 744785a2b7

View File

@ -52,22 +52,22 @@ class ContentReviewReportTest extends FunctionalTest
"ReviewDateBefore" => "2010-12-12", "ReviewDateBefore" => "2010-12-12",
]); ]);
$this->assertListEquals([ $recordTitles = $results->column('Title');
['Title' => 'Contact Us Child'], $this->assertCount(5, $recordTitles, 'The right number of pages are returned');
['Title' => 'Home'], $this->assertContains('Contact Us Child', $recordTitles);
['Title' => 'About Us'], $this->assertContains('Home', $recordTitles);
['Title' => 'Staff'], $this->assertContains('About Us', $recordTitles);
['Title' => 'Contact Us'], $this->assertContains('Staff', $recordTitles);
], $results); $this->assertContains('Contact Us', $recordTitles);
DBDatetime::set_mock_now("2010-02-13 00:00:00"); DBDatetime::set_mock_now("2010-02-13 00:00:00");
$results = $report->sourceRecords([]); $results = $report->sourceRecords([]);
$this->assertEquals([ $recordTitles = $results->column('Title');
"Home", $this->assertCount(2, $recordTitles, 'The right number of pages are returned');
"About Us", $this->assertContains('Home', $recordTitles);
], $results->column("Title")); $this->assertContains('About Us', $recordTitles);
DBDatetime::clear_mock_now(); DBDatetime::clear_mock_now();
} }
@ -87,11 +87,11 @@ class ContentReviewReportTest extends FunctionalTest
$results = $report->sourceRecords(); $results = $report->sourceRecords();
$this->assertEquals([ $recordTitles = $results->column('Title');
"Home", $this->assertCount(4, $recordTitles, 'The right number of pages are returned');
"About Us", $this->assertContains('Home', $recordTitles);
"Page without review date", $this->assertContains('About Us', $recordTitles);
"Page owned by group", $this->assertContains('Page without review date', $recordTitles);
], $results->column("Title")); $this->assertContains('Page owned by group', $recordTitles);
} }
} }