From 745ed40d46c18c683322b19939455deed52e94df Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 18 Jun 2022 19:53:46 +0200 Subject: Fix ConcertTable tests and markup. --- tests/ConcertsTableTest.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests/ConcertsTableTest.php') diff --git a/tests/ConcertsTableTest.php b/tests/ConcertsTableTest.php index 6f9d9d2..f6ee3cd 100644 --- a/tests/ConcertsTableTest.php +++ b/tests/ConcertsTableTest.php @@ -34,7 +34,7 @@ class ConcertsTableTest extends WP_UnitTestCase $created_venues[] = GiglogAdmin_Venue::find_or_create($venue[0], $venue[1]); } - $today = date("Y-m-d"); + $today = new DateTime(); foreach (self::CONCERTS as $concert) { for ($i = 0; $i < $concert[2]; $i++) { @@ -45,10 +45,13 @@ class ConcertsTableTest extends WP_UnitTestCase $concert_name = $concert[0]; } + $offset = rand(1, 13); + $concert_date = $today->modify( "+$offset days" ); + self::$concerts[] = GiglogAdmin_Concert::create( $concert_name, $created_venues[$concert[1]]->id(), - $today, + $concert_date->format( 'Y-m-d' ), "https://example.com/tickets/42", "https://example.com/events/93"); } @@ -104,8 +107,8 @@ class ConcertsTableTest extends WP_UnitTestCase } } - $this->assertEquals(64, $assignit_count); // four for each gig - $this->assertEquals(16, $adminactions_count); // once for each gig + $this->assertEquals(60, $assignit_count); // four for each gig + $this->assertEquals(15, $adminactions_count); // once for each gig } function testDontShowAdminOnlyControlsToNonAdminsOnAdminPage() { @@ -138,7 +141,7 @@ class ConcertsTableTest extends WP_UnitTestCase } } - $this->assertEquals(64, $assignit_count); // four for each gig + $this->assertEquals(60, $assignit_count); // four for each gig $this->assertEquals(0, $adminactions_count); // once for each gig } -- cgit v1.2.3