Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(sdk-php): assert method and path for label, channel, product reads

Yudhi Armyndharis5401ebc0490b
diff --git a/sdk/php/tests/LabelsChannelsCatalogTest.php b/sdk/php/tests/LabelsChannelsCatalogTest.php
index 5121b6e37..ea3f026d5 100644
--- a/sdk/php/tests/LabelsChannelsCatalogTest.php
+++ b/sdk/php/tests/LabelsChannelsCatalogTest.php
@@ -22,6 +22,8 @@ class LabelsChannelsCatalogTest extends TestCase
$client->labels->get('s', 'l1');
$this->assertStringContainsString('/labels/l1', $backend->calls()[1]['path']);
$client->labels->forChat('s', '[email protected]');
+ $this->assertSame('GET', $backend->lastCall()['method']);
+ $this->assertSame('/api/sessions/s/labels/chat/[email protected]', $backend->lastCall()['path']);
$client->labels->addToChat('s', '[email protected]', ['labelId' => 'l1']);
$this->assertSame('POST', $backend->calls()[3]['method']);
$this->assertSame(['labelId' => 'l1'], $backend->calls()[3]['body']);
@@ -41,6 +43,8 @@ class LabelsChannelsCatalogTest extends TestCase
$client->channels->list('s');
$this->assertStringContainsString('/sessions/s/channels', $backend->calls()[0]['path']);
$client->channels->get('s', '123@newsletter');
+ $this->assertSame('GET', $backend->lastCall()['method']);
+ $this->assertSame('/api/sessions/s/channels/123@newsletter', $backend->lastCall()['path']);
$client->channels->messages('s', '123@newsletter', ['limit' => 10]);
$this->assertStringContainsString('limit=10', $backend->calls()[2]['query']);
$client->channels->subscribe('s', ['inviteCode' => 'ABCxyz']);
@@ -63,6 +67,8 @@ class LabelsChannelsCatalogTest extends TestCase
$client->catalog->products('s', ['page' => 1, 'limit' => 20]);
$this->assertStringContainsString('page=1', $backend->calls()[1]['query']);
$client->catalog->product('s', 'p1');
+ $this->assertSame('GET', $backend->lastCall()['method']);
+ $this->assertSame('/api/sessions/s/catalog/products/p1', $backend->lastCall()['path']);
$client->catalog->sendProduct('s', ['chatId' => '[email protected]', 'productId' => 'p1', 'body' => 'x']);
$this->assertStringContainsString('/messages/send-product', $backend->calls()[3]['path']);
$this->assertSame(['chatId' => '[email protected]', 'productId' => 'p1', 'body' => 'x'], $backend->calls()[3]['body']);