Skip to content

Commit

Permalink
expose floor information when changing object status (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
bverbeken authored Sep 4, 2024
1 parent 0c22490 commit 59699e6
Show file tree
Hide file tree
Showing 7 changed files with 679 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/Common/Floor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Seatsio\Common;

class Floor
{
/**
* @var string
*/
public $name;

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

}
4 changes: 4 additions & 0 deletions src/Events/EventObjectInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class EventObjectInfo
* @var string
*/
public $section;
/**
* @var \Seatsio\Common\Floor
*/
var $floor;
/**
* @var string
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

require dirname(__FILE__) . '/SeatsioClientTest.php';
require dirname(__FILE__) . '/LabelsBuilder.php';
require dirname(__FILE__) . '/../vendor/autoload.php';
require dirname(__FILE__) . '/FloorBuilder.php';
require dirname(__FILE__) . '/../vendor/autoload.php';
13 changes: 13 additions & 0 deletions tests/Events/BookObjectsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ public function test()
self::assertEquals(["A-1", "A-2"], SeatsioClientTest::sort(array_keys($res->objects)));
}

public function testFloors()
{
$chartKey = $this->createTestChartWithFloors();
$event = $this->seatsioClient->events->create($chartKey);

$res = $this->seatsioClient->events->book($event->key, ["S1-A-1"]);

$a1ObjectInfo = $res->objects["S1-A-1"];

self::assertEquals(aFloor("1", "Floor 1"), $a1ObjectInfo->floor);
}

public function testSections()
{
$chartKey = $this->createTestChartWithSections();
Expand All @@ -34,6 +46,7 @@ public function testSections()
$a1ObjectInfo = $res->objects["Section A-A-1"];
self::assertEquals("Section A", $a1ObjectInfo->section);
self::assertEquals("Entrance 1", $a1ObjectInfo->entrance);
self::assertNull($a1ObjectInfo->floor);
self::assertEquals(someLabels("1", "seat", "A", "row", "Section A"), $a1ObjectInfo->labels);
self::assertEquals(new IDs("1", "A", "Section A"), $a1ObjectInfo->ids);
}
Expand Down
11 changes: 11 additions & 0 deletions tests/FloorBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

use Seatsio\Common\Floor;

function aFloor($name, $displayName)
{
$floor = new Floor();
$floor->name = $name;
$floor->displayName = $displayName;
return $floor;
}
5 changes: 5 additions & 0 deletions tests/SeatsioClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ protected function createTestChartWithSections()
return $this->createTestChartFromFile('sampleChartWithSections.json');
}

protected function createTestChartWithFloors()
{
return $this->createTestChartFromFile('sampleChartWithFloors.json');
}

protected function createTestChartWithZones()
{
return $this->createTestChartFromFile('sampleChartWithZones.json');
Expand Down
Loading

0 comments on commit 59699e6

Please sign in to comment.