| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,70 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Telnyx; |
|
| 4 |
+ |
|
| 5 |
+/** |
|
| 6 |
+ * @internal |
|
| 7 |
+ * @covers \Telnyx\FaxApplication |
|
| 8 |
+ */ |
|
| 9 |
+final class FaxApplicationTest extends \Telnyx\TestCase |
|
| 10 |
+{
|
|
| 11 |
+ const TEST_RESOURCE_ID = '1293384261075731499'; |
|
| 12 |
+ |
|
| 13 |
+ public function testIsListable() |
|
| 14 |
+ {
|
|
| 15 |
+ $this->expectsRequest( |
|
| 16 |
+ 'get', |
|
| 17 |
+ '/v2/fax_applications' |
|
| 18 |
+ ); |
|
| 19 |
+ $resources = FaxApplication::all(); |
|
| 20 |
+ $this->assertInstanceOf(\Telnyx\Collection::class, $resources); |
|
| 21 |
+ $this->assertInstanceOf(\Telnyx\FaxApplication::class, $resources['data'][0]); |
|
| 22 |
+ } |
|
| 23 |
+ |
|
| 24 |
+ public function testIsCreatable() |
|
| 25 |
+ {
|
|
| 26 |
+ $this->expectsRequest( |
|
| 27 |
+ 'post', |
|
| 28 |
+ '/v2/fax_applications' |
|
| 29 |
+ ); |
|
| 30 |
+ $resource = FaxApplication::create([ |
|
| 31 |
+ "application_name" => "call-router", |
|
| 32 |
+ "webhook_event_url" => "https://example.com" |
|
| 33 |
+ ]); |
|
| 34 |
+ $this->assertInstanceOf(\Telnyx\FaxApplication::class, $resource); |
|
| 35 |
+ } |
|
| 36 |
+ |
|
| 37 |
+ public function testIsRetrievable() |
|
| 38 |
+ {
|
|
| 39 |
+ $this->expectsRequest( |
|
| 40 |
+ 'get', |
|
| 41 |
+ '/v2/fax_applications/' . urlencode(self::TEST_RESOURCE_ID) |
|
| 42 |
+ ); |
|
| 43 |
+ $resource = FaxApplication::retrieve(self::TEST_RESOURCE_ID); |
|
| 44 |
+ $this->assertInstanceOf(\Telnyx\FaxApplication::class, $resource); |
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 47 |
+ public function testIsUpdatable() |
|
| 48 |
+ {
|
|
| 49 |
+ $this->expectsRequest( |
|
| 50 |
+ "patch", |
|
| 51 |
+ "/v2/fax_applications/" . urlencode(self::TEST_RESOURCE_ID) |
|
| 52 |
+ ); |
|
| 53 |
+ $resource = FaxApplication::update(self::TEST_RESOURCE_ID, [ |
|
| 54 |
+ "application_name" => "call-router", |
|
| 55 |
+ "webhook_event_url" => "https://example.com" |
|
| 56 |
+ ]); |
|
| 57 |
+ $this->assertInstanceOf(\Telnyx\FaxApplication::class, $resource); |
|
| 58 |
+ } |
|
| 59 |
+ |
|
| 60 |
+ public function testIsDeletable() |
|
| 61 |
+ {
|
|
| 62 |
+ $resource = FaxApplication::retrieve(self::TEST_RESOURCE_ID); |
|
| 63 |
+ $this->expectsRequest( |
|
| 64 |
+ 'delete', |
|
| 65 |
+ '/v2/fax_applications/' . urlencode(self::TEST_RESOURCE_ID) |
|
| 66 |
+ ); |
|
| 67 |
+ $resource->delete(); |
|
| 68 |
+ $this->assertInstanceOf(\Telnyx\FaxApplication::class, $resource); |
|
| 69 |
+ } |
|
| 70 |
+} |