Skip to content

Commit

Permalink
Expose more season data on events (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux authored Feb 24, 2022
1 parent 1d8e24e commit 6e78268
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ class Event
*/
public $socialDistancingRulesetKey;

/**
* @var string
*/
public $topLevelSeasonKey;

/**
* @var bool
*/
public $isTopLevelSeason;

/**
* @var bool
*/
public $isPartialSeason;

/**
* @var bool
*/
public $isEventInSeason;

public function isSeason() {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Events/RetrieveEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function test()
$retrievedEvent = $this->seatsioClient->events->retrieve($event->key);

self::assertEquals($event->key, $retrievedEvent->key);
self::assertEquals(false, $retrievedEvent->isEventInSeason);
self::assertEquals($event->id, $retrievedEvent->id);
self::assertEquals($chartKey, $retrievedEvent->chartKey);
self::assertEquals(TableBookingConfig::inherit(), $retrievedEvent->tableBookingConfig);
Expand All @@ -35,6 +36,7 @@ public function testRetrieveSeason()
$retrievedSeason = $this->seatsioClient->events->retrieve($season->key);

self::assertEquals('aSeason', $retrievedSeason->key);
self::assertEquals(true, $retrievedSeason->isTopLevelSeason);
self::assertEquals(['partialSeason1', 'partialSeason2'], $retrievedSeason->partialSeasonKeys);
}

Expand Down
6 changes: 4 additions & 2 deletions tests/Seasons/CreateEventsInSeasonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CreateEventsInSeasonTest extends SeatsioClientTest
{
public function eventKeys()
public function testEventKeys()
{
$chartKey = $this->createTestChart();
$season = $this->seatsioClient->seasons->create($chartKey);
Expand All @@ -18,9 +18,11 @@ public function eventKeys()
return $event->key;
});
self::assertEquals(['event1', 'event2'], $eventKeys);
self::assertEquals(true, $updatedSeason->events[0]->isEventInSeason);
self::assertEquals($season->key, $updatedSeason->events[0]->topLevelSeasonKey);
}

public function numberOfEvents()
public function testNumberOfEvents()
{
$chartKey = $this->createTestChart();
$season = $this->seatsioClient->seasons->create($chartKey);
Expand Down
2 changes: 2 additions & 0 deletions tests/Seasons/CreatePartialSeasonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public function test()
$partialSeason = $this->seatsioClient->seasons->createPartialSeason($season->key);

self::assertNotNull($partialSeason->key);
self::assertEquals(true, $partialSeason->isPartialSeason);
self::assertEquals($season->key, $partialSeason->topLevelSeasonKey);
}

public function testPartialSeasonKeyCanBePassedIn()
Expand Down
3 changes: 2 additions & 1 deletion tests/Seasons/CreateSeasonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

class CreateSeasonTest extends SeatsioClientTest
{

public function testOnlyChartKeyIsRequired()
{
$chartKey = $this->createTestChart();

$season = $this->seatsioClient->seasons->create($chartKey);

self::assertNotNull($season->key);
self::assertEquals(true, $season->isTopLevelSeason);
self::assertNull($season->topLevelSeasonKey);
self::assertNotNull($season->id);
self::assertEquals($chartKey, $season->chartKey);
self::assertEquals(TableBookingConfig::inherit(), $season->tableBookingConfig);
Expand Down

0 comments on commit 6e78268

Please sign in to comment.