From 82c4a8f2c4e5acd80b813829cecc40f621da3b21 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 14 Jun 2021 10:07:55 +0200 Subject: Begin move roles and status field to concerts table. There's no need to have a separate table (concertlogs) for these fields. --- tests/ConcertTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/ConcertTest.php') diff --git a/tests/ConcertTest.php b/tests/ConcertTest.php index 2c747b8..7edda46 100644 --- a/tests/ConcertTest.php +++ b/tests/ConcertTest.php @@ -86,6 +86,30 @@ final class ConcertTest extends WP_UnitTestCase $this->assertEquals($gig->id(), $fetched_gig->id()); $this->assertEquals($gig->cname(), $fetched_gig->cname()); $this->assertEquals($venue->id(), $fetched_gig->venue()->id()); + $this->assertEquals(GiglogAdmin_Concert::STATUS_NONE, $fetched_gig->status()); + $this->assertEquals([], $fetched_gig->roles()); + } + + public function testSetConcertStatus() : void + { + $venue = GiglogAdmin_Venue::create("a venue"); + $today = date("Y-m-d"); + + $gig = GiglogAdmin_Concert::create( + "a concert123", + $venue->id(), + $today, + "https://example.com/tickets/42", + "https://example.com/events/93"); + + $fetched_gig = GiglogAdmin_Concert::get($gig->id()); + $fetched_gig->set_status( GiglogAdmin_Concert::STATUS_ACCRED_REQ ); + $this->assertEquals( GiglogAdmin_Concert::STATUS_ACCRED_REQ, $fetched_gig->status() ); + + $fetched_gig->save(); + + $fetched_gig_2 = GiglogAdmin_Concert::get($gig->id()); + $this->assertEquals( GiglogAdmin_Concert::STATUS_ACCRED_REQ, $fetched_gig_2->status() ); } public function testOnlyFetchConcertsFromGivenCity() : void -- cgit v1.2.3