Skip to content

Commit

Permalink
Added statusChange.isPresentOnChart and statusChange.notPresentOnChar…
Browse files Browse the repository at this point in the history
…tReason (#48)
  • Loading branch information
mroloux authored Feb 24, 2022
1 parent 8abbac2 commit 0bda34d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Events/StatusChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ class StatusChange
* @var StatusChangeOrigin
*/
public $origin;
/**
* @var boolean
*/
public $isPresentOnChart;
/**
* @var string
*/
public $notPresentOnChartReason;
}
17 changes: 17 additions & 0 deletions tests/Events/ListStatusChangesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Seatsio\Events\EventObjectInfo;
use Seatsio\Events\ObjectProperties;
use Seatsio\Events\TableBookingConfig;
use Seatsio\SeatsioClientTest;
use function Functional\map;

Expand Down Expand Up @@ -45,6 +46,22 @@ public function testPropertiesOfStatusChange()
self::assertEquals((object)["foo" => "bar"], $statusChange->extraData);
self::assertEquals("API_CALL", $statusChange->origin->type);
self::assertNotNull($statusChange->origin->ip);
self::assertTrue($statusChange->isPresentOnChart);
self::assertNull($statusChange->notPresentOnChartReason);
}

public function testNotPresentOnChartAnymore()
{
$chartKey = $this->createTestChartWithTables();
$event = $this->seatsioClient->events->create($chartKey, null, TableBookingConfig::allByTable());
$this->seatsioClient->events->book($event->key, "T1");
$this->seatsioClient->events->update($event->key, null, null, TableBookingConfig::allBySeat());

$statusChanges = $this->seatsioClient->events->statusChanges($event->key)->all();
$statusChange = $statusChanges->current();

self::assertFalse($statusChange->isPresentOnChart);
self::assertEquals("SWITCHED_TO_BOOK_BY_SEAT", $statusChange->notPresentOnChartReason);
}

public function testFilter()
Expand Down

0 comments on commit 0bda34d

Please sign in to comment.