Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(sdk-php): pin both ends of the accepted idempotency key range

Yudhi Armyndharis61baa2998621
diff --git a/sdk/php/tests/ResourcesTest.php b/sdk/php/tests/ResourcesTest.php
index ec7326a29..617297ff9 100644
--- a/sdk/php/tests/ResourcesTest.php
+++ b/sdk/php/tests/ResourcesTest.php
@@ -616,7 +616,7 @@ class ResourcesTest extends TestCase
['reply', 'reply', ['chatId' => '[email protected]', 'quotedMessageId' => 'q', 'text' => 'reply']],
['forward', 'forward', ['fromChatId' => '[email protected]', 'toChatId' => '[email protected]', 'messageId' => 'm']],
];
- foreach ([null, '!', str_repeat('a', 255)] as $key) {
+ foreach ([null, '!', '~', 'a', str_repeat('a', 255)] as $key) {
$backend = new MockBackend();
$client = $backend->makeClient();
foreach ($cases as $index => [$method, $segment, $body]) {
@@ -690,7 +690,7 @@ class ResourcesTest extends TestCase
{
$backend = new MockBackend();
$client = $backend->makeClient();
- foreach (['', ' ', 'contains space', "key\n", "\xC3\xA9", str_repeat('a', 256)] as $key) {
+ foreach (['', ' ', 'contains space', "key\n", "\xC3\xA9", "a\x7Fb", str_repeat('a', 256)] as $key) {
try {
$client->messages->sendText('s', ['chatId' => '[email protected]', 'text' => 'hello'], $key);
$this->fail('Expected invalid key to be refused');