Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(sdk): pin the PHP errno-28 timeout check on its own
Yudhi Armyndharis7294bc64567d
diff --git a/sdk/php/tests/ClientTest.php b/sdk/php/tests/ClientTest.phpindex cfe519817..e3d4a931f 100644--- a/sdk/php/tests/ClientTest.php+++ b/sdk/php/tests/ClientTest.php@@ -326,9 +326,10 @@ class ClientTest extends TestCasepublic function testTimeoutWithErrno28MapsToTimeoutException(): void{// Regression guard: cURL error 28 (CURLE_OPERATION_TIMEDOUT) must map to- // OpenWATimeoutException, regardless of the message wording.+ // OpenWATimeoutException, regardless of the message wording. The message+ // deliberately avoids 'timed out' so only the errno check can match it.$timeoutRequest = new \GuzzleHttp\Exception\ConnectException(- 'cURL error 28: Operation timed out',+ 'cURL error 28: Zeitlimit für Vorgang überschritten',new \GuzzleHttp\Psr7\Request('GET', '/api/sessions'),null,['errno' => 28],@@ -345,6 +346,26 @@ class ClientTest extends TestCase$client->sessions->list();}+ public function testTimedOutMessageWithoutErrnoMapsToTimeoutException(): void+ {+ // Transports that leave the handler context empty (e.g. the stream handler)+ // are classified by the 'timed out' message instead.+ $timeoutRequest = new \GuzzleHttp\Exception\ConnectException(+ 'Connection timed out after 10001 milliseconds',+ new \GuzzleHttp\Psr7\Request('GET', '/api/sessions'),+ );+ $mock = new \GuzzleHttp\Handler\MockHandler([$timeoutRequest]);+ $httpClient = new \GuzzleHttp\Client(['handler' => \GuzzleHttp\HandlerStack::create($mock)]);+ $client = new \OpenWA\Client([+ 'baseUrl' => 'http://localhost:2785',+ 'apiKey' => 'k',+ 'httpClient' => $httpClient,+ ]);++ $this->expectException(OpenWATimeoutException::class);+ $client->sessions->list();+ }+public function testConnectionRefusedDoesNotMapToTimeoutException(): void{// Regression guard: a non-timeout ConnectException (errno 7) must NOT be