From 224f0149ea513146b164736f461e6cbba4b86add Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 27 Jun 2021 13:05:08 +0200 Subject: Begin move roles and status field to concerts table. --- tests/ConcertTest.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/ConcertTest.php') diff --git a/tests/ConcertTest.php b/tests/ConcertTest.php index 77b1ed3..0bf345c 100644 --- a/tests/ConcertTest.php +++ b/tests/ConcertTest.php @@ -133,6 +133,31 @@ final class ConcertTest extends WP_UnitTestCase $this->assertEquals( GiglogAdmin_Concert::STATUS_ACCRED_REQ, $fetched_gig_2->status() ); } + public function testAssignConcertRoles() : 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"); + + $gig->assign_role( GiglogAdmin_Roles::PHOTO1, 'user1' ); + $this->assertEquals( [ GiglogAdmin_Roles::PHOTO1 => 'user1' ], $gig->roles() ); + + $gig->save(); + + var_dump($gig); + + $fetched_gig = GiglogAdmin_Concert::get( $gig->id() ); + global $wpdb; + $wpdb->print_error(); + $this->assertEquals( [ GiglogAdmin_Roles::PHOTO1 => 'user1' ], $fetched_gig->roles() ); + } + public function testOnlyFetchConcertsFromGivenCity() : void { $gigs_in_svene = GiglogAdmin_Concert::find_concerts([ "city" => "Svene"]); -- cgit v1.2.3