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,65 @@
1
+<?php
2
+
3
+namespace Telnyx;
4
+
5
+/**
6
+ * @internal
7
+ * @covers \Telnyx\TelephonyCredential
8
+ */
9
+final class TelephonyCredentialTest extends \Telnyx\TestCase
10
+{
11
+    const TEST_RESOURCE_ID = 'c215ade3-0d39-418e-94be-c5f780760199';
12
+    
13
+    public function testIsListable()
14
+    {
15
+        $this->expectsRequest(
16
+            'get',
17
+            '/v2/telephony_credentials'
18
+        );
19
+        $resources = TelephonyCredential::all();
20
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
21
+        $this->assertInstanceOf(\Telnyx\TelephonyCredential::class, $resources['data'][0]);
22
+    }
23
+
24
+    public function testIsCreatable()
25
+    {
26
+        $this->expectsRequest(
27
+            'post',
28
+            '/v2/telephony_credentials'
29
+        );
30
+        $resource = TelephonyCredential::create(["connection_id" => "1234567890", "name" => "My-new-credential"]);
31
+        $this->assertInstanceOf(\Telnyx\TelephonyCredential::class, $resource);
32
+    }
33
+
34
+    public function testIsRetrievable()
35
+    {
36
+        $this->expectsRequest(
37
+            'get',
38
+            '/v2/telephony_credentials/' . urlencode(self::TEST_RESOURCE_ID)
39
+        );
40
+        $resource = TelephonyCredential::retrieve(self::TEST_RESOURCE_ID);
41
+        $this->assertInstanceOf(\Telnyx\TelephonyCredential::class, $resource);
42
+    }
43
+
44
+    public function testIsUpdatable()
45
+    {
46
+        $this->expectsRequest(
47
+            'patch',
48
+            '/v2/telephony_credentials/' . urlencode(self::TEST_RESOURCE_ID)
49
+        );
50
+        $resource = TelephonyCredential::update(self::TEST_RESOURCE_ID, ["connection_id" => "987654321", "name" => "My-new-updated-credential"]);
51
+        $this->assertInstanceOf(\Telnyx\TelephonyCredential::class, $resource);
52
+    }
53
+
54
+    public function testIsDeletable()
55
+    {
56
+        $resource = TelephonyCredential::retrieve(self::TEST_RESOURCE_ID);
57
+        $this->expectsRequest(
58
+            'delete',
59
+            '/v2/telephony_credentials/' . urlencode(self::TEST_RESOURCE_ID)
60
+        );
61
+        $resource->delete();
62
+        $this->assertInstanceOf(\Telnyx\TelephonyCredential::class, $resource);
63
+    }
64
+
65
+}