Browse code

Added README.md appinfo/info.xml appinfo/signature.json lib/Controller/AuthorApiController.php and the providers directory

DoubleBastionAdmin authored on 20/08/2022 16:33:00
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,68 @@
1
+<?php
2
+
3
+namespace Telnyx;
4
+
5
+/**
6
+ * @internal
7
+ * @covers \Telnyx\Portout
8
+ */
9
+final class PortoutTest extends \Telnyx\TestCase
10
+{
11
+    const TEST_RESOURCE_ID = '123';
12
+
13
+    public function testIsListable()
14
+    {
15
+        $this->expectsRequest(
16
+            'get',
17
+            '/v2/portouts'
18
+        );
19
+        $resources = Portout::all();
20
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
21
+        $this->assertInstanceOf(\Telnyx\Portout::class, $resources['data'][0]);
22
+    }
23
+
24
+    public function testIsRetrievable()
25
+    {
26
+        $this->expectsRequest(
27
+            'get',
28
+            '/v2/portouts/' . urlencode(self::TEST_RESOURCE_ID)
29
+        );
30
+        $resource = Portout::retrieve(self::TEST_RESOURCE_ID);
31
+        $this->assertInstanceOf(\Telnyx\Portout::class, $resource);
32
+    }
33
+
34
+    public function testUpdateStatus()
35
+    {
36
+        $portout_status = 'authorized';
37
+        $portout = Portout::retrieve(self::TEST_RESOURCE_ID);
38
+        $this->expectsRequest(
39
+            'patch',
40
+            '/v2/portouts/' . urlencode(self::TEST_RESOURCE_ID) . '/' . $portout_status
41
+        );
42
+        $resources = $portout->update_status($portout_status);
43
+        $this->assertInstanceOf(\Telnyx\Portout::class, $resources);
44
+    }
45
+
46
+    public function testListComments()
47
+    {
48
+        $portout = Portout::retrieve(self::TEST_RESOURCE_ID);
49
+        $this->expectsRequest(
50
+            'get',
51
+            '/v2/portouts/' . urlencode(self::TEST_RESOURCE_ID) . '/comments'
52
+        );
53
+        $resources = $portout->list_comments();
54
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
55
+        $this->assertInstanceOf(\Telnyx\Portout::class, $resources['data'][0]);
56
+    }
57
+
58
+    public function testCreateComment()
59
+    {
60
+        $portout = Portout::retrieve(self::TEST_RESOURCE_ID);
61
+        $this->expectsRequest(
62
+            'post',
63
+            '/v2/portouts/' . urlencode(self::TEST_RESOURCE_ID) . '/comments'
64
+        );
65
+        $resources = $portout->create_comment(['body'=>'comment']);
66
+        $this->assertInstanceOf(\Telnyx\Portout::class, $resources);
67
+    }
68
+}