Skip to content

Commit ecbd02e

Browse files
committed
Add tests for AvailablePhoneNumbers
1 parent 9a237a3 commit ecbd02e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/MessageBird/Resources/AvailablePhoneNumbers.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ private function processRequest($body)
7575
$body = @json_decode($body);
7676

7777
if ($body === null or $body === false) {
78-
throw new Exceptions\ServerException('Got an invalid JSON response from the server.');
78+
throw new \MessageBird\Exceptions\ServerException('Got an invalid JSON response from the server.');
7979
}
8080

8181
if (empty($body->errors)) {
8282
return Objects\Number.loadFromArray($body->data[0]);
8383
}
8484

8585
$ResponseError = new Common\ResponseError($body);
86-
throw new Exceptions\RequestException($ResponseError->getErrorString());
86+
throw new \MessageBird\Exceptions\RequestException($ResponseError->getErrorString());
8787
}
8888
}
8989
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
class AvailablePhoneNumbersTest extends BaseTest
3+
{
4+
protected function setUp(): void
5+
{
6+
parent::setUp();
7+
$this->client = new \MessageBird\Client('YOUR_ACCESS_KEY', $this->mockClient);
8+
}
9+
10+
public function testListAvailablePhoneNumbers()
11+
{
12+
$this->expectException(\MessageBird\Exceptions\ServerException::class);
13+
$this->mockClient->expects($this->once())->method('performHttpRequest')->with('GET', 'available-phone-numbers/nl', array (), null);
14+
$this->client->availablePhoneNumbers->getList("nl", array());
15+
}
16+
}

0 commit comments

Comments
 (0)