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