Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(sdk): stop calling status recipients required in the PHP test

Yudhi Armyndharisba9ab4ded2d5
diff --git a/sdk/php/tests/ResourcesTest.php b/sdk/php/tests/ResourcesTest.php
index b88ae2862..381c88573 100644
--- a/sdk/php/tests/ResourcesTest.php
+++ b/sdk/php/tests/ResourcesTest.php
@@ -417,7 +417,7 @@ class ResourcesTest extends TestCase
// ── Status (Stories) ──────────────────────────────────────────────
- public function testStatusSendForwardsRequiredRecipientsAndNestedMedia(): void
+ public function testStatusSendForwardsRecipientsAndNestedMedia(): void
{
$backend = new MockBackend();
$backend->on(200, ['statusId' => 's1', 'timestamp' => '2025-01-01T00:00:00.000Z', 'expiresAt' => '2025-01-02T00:00:00.000Z']);
@@ -425,17 +425,18 @@ class ResourcesTest extends TestCase
$backend->on(200, ['statusId' => 's3', 'timestamp' => '2025-01-01T00:00:00.000Z', 'expiresAt' => '2025-01-02T00:00:00.000Z']);
$backend->on(200, ['statusId' => 's4', 'timestamp' => '2025-01-01T00:00:00.000Z', 'expiresAt' => '2025-01-02T00:00:00.000Z']);
$client = $backend->makeClient();
- // Server requires `recipients` on every status post; media posts use a nested {image|video:{...}} body.
- $client->status->sendText('s', ['text' => 'hi', 'recipients' => ['[email protected]']]);
- $this->assertSame(['text' => 'hi', 'recipients' => ['[email protected]']], $backend->lastCall()['body']);
- $client->status->sendImage('s', ['image' => ['url' => 'http://img'], 'recipients' => ['[email protected]'], 'caption' => 'c']);
- $this->assertSame(['image' => ['url' => 'http://img'], 'recipients' => ['[email protected]'], 'caption' => 'c'], $backend->lastCall()['body']);
- $client->status->sendVideo('s', ['video' => ['url' => 'http://vid'], 'recipients' => ['[email protected]']]);
- $this->assertSame(['video' => ['url' => 'http://vid'], 'recipients' => ['[email protected]']], $backend->lastCall()['body']);
+ // `recipients` is forwarded verbatim (required on Baileys, ignored by whatsapp-web.js); media posts
+ // use a nested {image|video|audio:{...}} body.
+ $client->status->sendText('s', ['text' => 'hi', 'recipients' => ['[email protected]']]);
+ $this->assertSame(['text' => 'hi', 'recipients' => ['[email protected]']], $backend->lastCall()['body']);
+ $client->status->sendImage('s', ['image' => ['url' => 'http://img'], 'recipients' => ['[email protected]'], 'caption' => 'c']);
+ $this->assertSame(['image' => ['url' => 'http://img'], 'recipients' => ['[email protected]'], 'caption' => 'c'], $backend->lastCall()['body']);
+ $client->status->sendVideo('s', ['video' => ['url' => 'http://vid'], 'recipients' => ['[email protected]']]);
+ $this->assertSame(['video' => ['url' => 'http://vid'], 'recipients' => ['[email protected]']], $backend->lastCall()['body']);
// A voice status wraps its media under `audio` and carries no caption.
- $client->status->sendVoice('s', ['audio' => ['base64' => 'T2dnUw=='], 'recipients' => ['[email protected]']]);
+ $client->status->sendVoice('s', ['audio' => ['base64' => 'T2dnUw=='], 'recipients' => ['[email protected]']]);
$this->assertSame('/api/sessions/s/status/send-voice', $backend->lastCall()['path']);
- $this->assertSame(['audio' => ['base64' => 'T2dnUw=='], 'recipients' => ['[email protected]']], $backend->lastCall()['body']);
+ $this->assertSame(['audio' => ['base64' => 'T2dnUw=='], 'recipients' => ['[email protected]']], $backend->lastCall()['body']);
}
public function testVotePollPostsOptionTexts(): void