diff --git a/src/Events/Channels.php b/src/Events/Channels.php new file mode 100644 index 0000000..48f3027 --- /dev/null +++ b/src/Events/Channels.php @@ -0,0 +1,157 @@ +client = $client; + } + + + /** + * Add a channel + * + * @param string $eventKey + * @param string $channelKey + * @param string $name + * @param string $color + * @param int|null $index + * @param array|null $objects + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function add(string $eventKey, string $channelKey, string $name, string $color, int $index = null, array $objects = null) + { + $request = new stdClass(); + $request->key = $channelKey; + $request->name = $name; + $request->color = $color; + if ($index !== null) { + $request->index = $index; + } + if ($objects !== null) { + $request->objects = $objects; + } + $this->client->post(UriTemplate::expand('/events/{key}/channels', array("key" => $eventKey)), ['json' => $request]); + } + + /** + * remove a channel by channel key + * + * @param string $eventKey + * @param string $channelKey + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function remove(string $eventKey, string $channelKey) + { + $this->client->delete(UriTemplate::expand('/events/{eventKey}/channels/{channelKey}', array("eventKey" => $eventKey, "channelKey" => $channelKey))); + } + + /** + * update the name, color or objects of a channel + * + * @param string $eventKey + * @param string $channelKey + * @param string|null $name + * @param string|null $color + * @param array|null $objects + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function update(string $eventKey, string $channelKey, string $name = null, string $color = null, array $objects = null) + { + $request = new stdClass(); + if ($name !== null) { + $request->name = $name; + } + if ($color !== null) { + $request->color = $color; + } + if ($objects !== null) { + $request->objects = $objects; + } + $this->client->post(UriTemplate::expand('/events/{eventKey}/channels/{channelKey}', array("eventKey" => $eventKey, "channelKey" => $channelKey)), + ['json' => $request]); + } + + /** + * add objects to a channel. + * + * @param string $eventKey + * @param string $channelKey + * @param array $objects + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function addObjects(string $eventKey, string $channelKey, array $objects) + { + $request = new stdClass(); + $request->objects = $objects; + $this->client->post(UriTemplate::expand('/events/{eventKey}/channels/{channelKey}/objects', array( + "eventKey" => $eventKey, + "channelKey" => $channelKey) + ), ['json' => $request]); + } + + /** + * Remove objects from a channel + * + * @param string $eventKey + * @param string $channelKey + * @param array $objects + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function removeObjects(string $eventKey, string $channelKey, array $objects) + { + $request = new stdClass(); + $request->objects = $objects; + $this->client->delete(UriTemplate::expand('/events/{eventKey}/channels/{channelKey}/objects', array( + "eventKey" => $eventKey, + "channelKey" => $channelKey) + ), ['json' => $request]); + } + + /** + * Replace one channel completely with a new channel + * + * @param string $eventKey + * @param array $channels + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function replace(string $eventKey, array $channels): void + { + $request = new stdClass(); + $request->channels = $channels; + $this->client->post(UriTemplate::expand('/events/{key}/channels/update', array("key" => $eventKey)), ['json' => $request]); + } + + /** + * Replace the list of current object labels on a channel with a new list of object labels. + * + * @param string $eventKey + * @param array $channelConfig + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function setObjects(string $eventKey, array $channelConfig): void + { + $request = new stdClass(); + $request->channelConfig = $channelConfig; + $this->client->post(UriTemplate::expand('/events/{key}/channels/assign-objects', array("key" => $eventKey)), ['json' => $request]); + } + +} diff --git a/src/Events/Events.php b/src/Events/Events.php index 9ad7328..d8426cb 100644 --- a/src/Events/Events.php +++ b/src/Events/Events.php @@ -19,9 +19,15 @@ class Events */ private $client; + /** + * @var Channels + */ + public $channels; + public function __construct(Client $client) { $this->client = $client; + $this->channels = new Channels($client); } public function create(string $chartKey, string $eventKey = null, TableBookingConfig $tableBookingConfig = null, string $socialDistancingRulesetKey = null, array $objectCategories = null): Event @@ -178,20 +184,6 @@ public function statusChangesForObject(string $eventKey, string $objectId): Stat })); } - public function updateChannels(string $eventKey, array $channels): void - { - $request = new stdClass(); - $request->channels = $channels; - $this->client->post(UriTemplate::expand('/events/{key}/channels/update', array("key" => $eventKey)), ['json' => $request]); - } - - public function assignObjectsToChannels(string $eventKey, array $channelConfig): void - { - $request = new stdClass(); - $request->channelConfig = $channelConfig; - $this->client->post(UriTemplate::expand('/events/{key}/channels/assign-objects', array("key" => $eventKey)), ['json' => $request]); - } - public function markAsForSale(string $eventKey, array $objects = null, array $categories = null): void { $request = new stdClass(); diff --git a/tests/Events/BookObjectsTest.php b/tests/Events/BookObjectsTest.php index eaa5514..4ad6e78 100644 --- a/tests/Events/BookObjectsTest.php +++ b/tests/Events/BookObjectsTest.php @@ -81,10 +81,10 @@ public function testChannelKeys() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); @@ -98,10 +98,10 @@ public function testIgnoreChannels() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); diff --git a/tests/Events/ChangeBestAvailableObjectStatusTest.php b/tests/Events/ChangeBestAvailableObjectStatusTest.php index ef0fe42..b838e79 100644 --- a/tests/Events/ChangeBestAvailableObjectStatusTest.php +++ b/tests/Events/ChangeBestAvailableObjectStatusTest.php @@ -150,10 +150,10 @@ public function testChannelKeys() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["B-6"] ]); @@ -166,10 +166,10 @@ public function testIgnoreChannels() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["B-5"] ]); diff --git a/tests/Events/ChangeObjectStatusInBatchTest.php b/tests/Events/ChangeObjectStatusInBatchTest.php index c0b5ff1..b4befc3 100644 --- a/tests/Events/ChangeObjectStatusInBatchTest.php +++ b/tests/Events/ChangeObjectStatusInBatchTest.php @@ -33,10 +33,10 @@ public function testChannelKeys() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1"] ]); @@ -51,10 +51,10 @@ public function testIgnoreChannels() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1"] ]); diff --git a/tests/Events/ChangeObjectStatusTest.php b/tests/Events/ChangeObjectStatusTest.php index ed3a863..de40ce9 100644 --- a/tests/Events/ChangeObjectStatusTest.php +++ b/tests/Events/ChangeObjectStatusTest.php @@ -127,10 +127,10 @@ public function testChannelKeys() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); @@ -144,10 +144,10 @@ public function testIgnoreChannels() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); diff --git a/tests/Events/Channels/AddChannelTest.php b/tests/Events/Channels/AddChannelTest.php new file mode 100644 index 0000000..ae8ed5e --- /dev/null +++ b/tests/Events/Channels/AddChannelTest.php @@ -0,0 +1,55 @@ +createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, ["A-1", "A-2"]); + $this->seatsioClient->events->channels->add($event->key, "channelKey2", "channel 2", "#FFFF99", 2, ["A-3"]); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + + self::assertEquals([ + new Channel("channel 1", "#FFFF98", 1, "channelKey1", ["A-1", "A-2"]), + new Channel("channel 2", "#FFFF99", 2, "channelKey2", ["A-3"]) + ], $retrievedEvent->channels); + } + + public function testIndexIsOptional() + { + $chartKey = $this->createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", null, ["A-1", "A-2"]); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + + self::assertEquals([ + new Channel("channel 1", "#FFFF98", 0, "channelKey1", ["A-1", "A-2"]), + ], $retrievedEvent->channels); + } + + public function testObjectsAreOptional() + { + $chartKey = $this->createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, null); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + + self::assertEquals([ + new Channel("channel 1", "#FFFF98", 1, "channelKey1", []), + ], $retrievedEvent->channels); + } + +} diff --git a/tests/Events/Channels/AddObjectsToChannelTest.php b/tests/Events/Channels/AddObjectsToChannelTest.php new file mode 100644 index 0000000..4f6a3d3 --- /dev/null +++ b/tests/Events/Channels/AddObjectsToChannelTest.php @@ -0,0 +1,29 @@ +createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, ["A-1", "A-2"]); + $this->seatsioClient->events->channels->add($event->key, "channelKey2", "channel 2", "#FFFF99", 2, ["A-3", "A-4"]); + + $this->seatsioClient->events->channels->addObjects($event->key, "channelKey1", ["A-3", "A-4"]); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + + self::assertEquals([ + new Channel("channel 1", "#FFFF98", 1, "channelKey1", ["A-1", "A-2", "A-3", "A-4"]), + new Channel("channel 2", "#FFFF99", 2, "channelKey2", []) + ], $retrievedEvent->channels); + } + +} diff --git a/tests/Events/Channels/RemoveChannelTest.php b/tests/Events/Channels/RemoveChannelTest.php new file mode 100644 index 0000000..1e91f06 --- /dev/null +++ b/tests/Events/Channels/RemoveChannelTest.php @@ -0,0 +1,31 @@ +createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + + $this->seatsioClient->events->channels->replace($event->key, [ + "channelKey1" => new Channel("channel 1", "#FF0000", 1), + "channelKey2" => new Channel("channel 2", "#00FFFF", 2) + ]); + + $this->seatsioClient->events->channels->remove($event->key, "channelKey2"); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + + self::assertEquals([ + new Channel("channel 1", "#FF0000", 1, "channelKey1", []), + ], $retrievedEvent->channels); + } + +} diff --git a/tests/Events/Channels/RemoveObjectsFromChannelTest.php b/tests/Events/Channels/RemoveObjectsFromChannelTest.php new file mode 100644 index 0000000..70d9c0e --- /dev/null +++ b/tests/Events/Channels/RemoveObjectsFromChannelTest.php @@ -0,0 +1,26 @@ +createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, ["A-1", "A-2", "A-3", "A-4"]); + + $this->seatsioClient->events->channels->removeObjects($event->key, "channelKey1", ["A-3", "A-4"]); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + + self::assertEquals([ + new Channel("channel 1", "#FFFF98", 1, "channelKey1", ["A-1", "A-2"]), + ], $retrievedEvent->channels); + } + +} diff --git a/tests/Events/UpdateChannelsTest.php b/tests/Events/Channels/ReplaceChannelsTest.php similarity index 76% rename from tests/Events/UpdateChannelsTest.php rename to tests/Events/Channels/ReplaceChannelsTest.php index b126253..cb475b0 100644 --- a/tests/Events/UpdateChannelsTest.php +++ b/tests/Events/Channels/ReplaceChannelsTest.php @@ -1,10 +1,11 @@ createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1), "channelKey2" => new Channel("channel 2", "#00FFFF", 2) ]); @@ -20,10 +21,9 @@ public function test() $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); self::assertEquals([ - new Channel("channel 1", "#FF0000", 1, "channelKey1", []), - new Channel("channel 2", "#00FFFF", 2, "channelKey2", []) + new Channel("channel 1", "#FF0000", 1, "channelKey1"), + new Channel("channel 2", "#00FFFF", 2, "channelKey2") ], $retrievedEvent->channels); - } } diff --git a/tests/Events/AssignObjectsToChannelsTest.php b/tests/Events/Channels/SetObjectsForChannelsTest.php similarity index 77% rename from tests/Events/AssignObjectsToChannelsTest.php rename to tests/Events/Channels/SetObjectsForChannelsTest.php index da00ecb..9476563 100644 --- a/tests/Events/AssignObjectsToChannelsTest.php +++ b/tests/Events/Channels/SetObjectsForChannelsTest.php @@ -4,19 +4,19 @@ use Seatsio\SeatsioClientTest; -class AssignObjectsToChannelsTest extends SeatsioClientTest +class SetObjectsForChannelsTest extends SeatsioClientTest { public function test() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1), "channelKey2" => new Channel("channel 2", "#00FFFF", 2) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"], "channelKey2" => ["A-3"] ]); @@ -24,7 +24,7 @@ public function test() $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); self::assertEquals([ - new Channel("channel 1", "#FF0000", 1, "channelKey1", ["A-1","A-2"]), + new Channel("channel 1", "#FF0000", 1, "channelKey1", ["A-1", "A-2"]), new Channel("channel 2", "#00FFFF", 2, "channelKey2", ["A-3"]) ], $retrievedEvent->channels); } diff --git a/tests/Events/Channels/UpdateChannelTest.php b/tests/Events/Channels/UpdateChannelTest.php new file mode 100644 index 0000000..084da3c --- /dev/null +++ b/tests/Events/Channels/UpdateChannelTest.php @@ -0,0 +1,53 @@ +createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, ["A-1", "A-2"]); + + $this->seatsioClient->events->channels->update($event->key, "channelKey1", "channel 2"); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + self::assertEquals([ + new Channel("channel 2", "#FFFF98", 1, "channelKey1", ["A-1", "A-2"]), + ], $retrievedEvent->channels); + } + + public function testUpdateColor() + { + $chartKey = $this->createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, ["A-1", "A-2"]); + + $this->seatsioClient->events->channels->update($event->key, "channelKey1", null, "#FFAABB"); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + self::assertEquals([ + new Channel("channel 1", "#FFAABB", 1, "channelKey1", ["A-1", "A-2"]), + ], $retrievedEvent->channels); + } + + public function testUpdateObjects() + { + $chartKey = $this->createTestChart(); + $event = $this->seatsioClient->events->create($chartKey); + $this->seatsioClient->events->channels->add($event->key, "channelKey1", "channel 1", "#FFFF98", 1, ["A-1", "A-2"]); + + $this->seatsioClient->events->channels->update($event->key, "channelKey1", null, null, ["A-3"]); + + $retrievedEvent = $this->seatsioClient->events->retrieve($event->key); + self::assertEquals([ + new Channel("channel 1", "#FFFF98", 1, "channelKey1", ["A-3"]), + ], $retrievedEvent->channels); + } + +} diff --git a/tests/Events/HoldObjectsTest.php b/tests/Events/HoldObjectsTest.php index f5c31ce..04925f9 100644 --- a/tests/Events/HoldObjectsTest.php +++ b/tests/Events/HoldObjectsTest.php @@ -58,10 +58,10 @@ public function testChannelKeys() $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); $holdToken = $this->seatsioClient->holdTokens->create(); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); @@ -76,10 +76,10 @@ public function testIgnoreChannels() $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); $holdToken = $this->seatsioClient->holdTokens->create(); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); diff --git a/tests/Events/ReleaseObjectsTest.php b/tests/Events/ReleaseObjectsTest.php index 31c42e2..d3335aa 100644 --- a/tests/Events/ReleaseObjectsTest.php +++ b/tests/Events/ReleaseObjectsTest.php @@ -64,10 +64,10 @@ public function testChannelKeys() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); $this->seatsioClient->events->book($event->key, "A-1", null, null, null, null, ["channelKey1"]); @@ -82,10 +82,10 @@ public function testIgnoreChannels() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channelKey1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, [ + $this->seatsioClient->events->channels->setObjects($event->key, [ "channelKey1" => ["A-1", "A-2"] ]); $this->seatsioClient->events->book($event->key, "A-1", null, null, null, null, ["channelKey1"]); diff --git a/tests/Reports/EventReportsSummaryTest.php b/tests/Reports/EventReportsSummaryTest.php index 5434c85..7f7a8ee 100644 --- a/tests/Reports/EventReportsSummaryTest.php +++ b/tests/Reports/EventReportsSummaryTest.php @@ -337,10 +337,10 @@ public function testSummaryByChannel() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channel1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, ["channel1" => ["A-1", "A-2"]]); + $this->seatsioClient->events->channels->setObjects($event->key, ["channel1" => ["A-1", "A-2"]]); $report = $this->seatsioClient->eventReports->summaryByChannel($event->key); diff --git a/tests/Reports/EventReportsTest.php b/tests/Reports/EventReportsTest.php index 1eed5d0..60fd758 100644 --- a/tests/Reports/EventReportsTest.php +++ b/tests/Reports/EventReportsTest.php @@ -17,10 +17,10 @@ public function testReportItemProperties() $event = $this->seatsioClient->events->create($chartKey); $extraData = ["foo" => "bar"]; $this->seatsioClient->events->book($event->key, (new ObjectProperties("A-1"))->setTicketType("ticketType1")->setExtraData($extraData), null, "order1"); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channel1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, ["channel1" => ["A-1"]]); + $this->seatsioClient->events->channels->setObjects($event->key, ["channel1" => ["A-1"]]); $report = $this->seatsioClient->eventReports->byLabel($event->key); @@ -299,10 +299,10 @@ public function testByChannel() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channel1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, ["channel1" => ["A-1", "A-2"]]); + $this->seatsioClient->events->channels->setObjects($event->key, ["channel1" => ["A-1", "A-2"]]); $report = $this->seatsioClient->eventReports->byChannel($event->key); @@ -314,10 +314,10 @@ public function testBySpecificChannel() { $chartKey = $this->createTestChart(); $event = $this->seatsioClient->events->create($chartKey); - $this->seatsioClient->events->updateChannels($event->key, [ + $this->seatsioClient->events->channels->replace($event->key, [ "channel1" => new Channel("channel 1", "#FF0000", 1) ]); - $this->seatsioClient->events->assignObjectsToChannels($event->key, ["channel1" => ["A-1", "A-2"]]); + $this->seatsioClient->events->channels->setObjects($event->key, ["channel1" => ["A-1", "A-2"]]); $report = $this->seatsioClient->eventReports->byChannel($event->key, 'channel1');