Skip to content

Commit beec656

Browse files
committed
add async get test
1 parent 180f448 commit beec656

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

tests/ApiTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,23 @@ public function testAsyncTnLookup() {
203203
$this->assertIsString($createResponse->getResult()->data->requestId);
204204
$this->assertIsString($createResponse->getResult()->data->status);
205205
$this->assertIsArray($createResponse->getResult()->errors);
206-
207-
// $requestId = $createResponse->getResult()->requestId;
208-
// $getResponse = $this->bandwidthClient->getPhoneNumberLookup()->getClient()->getLookupRequestStatus(getenv("BW_ACCOUNT_ID"), $requestId);
209-
// $this->assertTrue(strlen($getResponse->getResult()->status) > 0);
206+
207+
sleep(15);
208+
209+
$statusResponse = $this->bandwidthClient->getPhoneNumberLookup()->getClient()->getAsyncLookupRequestStatus(getenv("BW_ACCOUNT_ID"), $createResponse->getResult()->data->requestId);
210+
$this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResponse::class, $statusResponse->getResult());
211+
$this->assertIsArray($statusResponse->getResult()->links);
212+
$this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResponseData::class, $statusResponse->getResult()->data);
213+
$this->assertIsString($statusResponse->getResult()->data->requestId);
214+
$this->assertIsString($statusResponse->getResult()->data->status);
215+
$this->assertIsArray($statusResponse->getResult()->data->results);
216+
$this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResult::class, $statusResponse->getResult()->data->results[0]);
217+
$this->assertIsString($statusResponse->getResult()->data->results[0]->phoneNumber);
218+
$this->assertIsString($statusResponse->getResult()->data->results[0]->lineType);
219+
$this->assertIsString($statusResponse->getResult()->data->results[0]->messagingProvider);
220+
$this->assertIsString($statusResponse->getResult()->data->results[0]->voiceProvider);
221+
$this->assertIsString($statusResponse->getResult()->data->results[0]->countryCodeA3);
222+
$this->assertIsArray($statusResponse->getResult()->errors);
210223
}
211224

212225
public function testSyncTnLookup() {

0 commit comments

Comments
 (0)