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