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,101 @@
1
+<?php
2
+
3
+namespace Telnyx;
4
+
5
+class MessagingProfileTest extends TestCase
6
+{
7
+    const TEST_RESOURCE_ID = '123';
8
+
9
+
10
+    public function testIsListable()
11
+    {
12
+        $this->expectsRequest(
13
+            'get',
14
+            '/v2/messaging_profiles'
15
+        );
16
+        $resources = MessagingProfile::all();
17
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
18
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resources[0]);
19
+    }
20
+
21
+    public function testIsRetrievable()
22
+    {
23
+        $this->expectsRequest(
24
+            'get',
25
+            '/v2/messaging_profiles/' . urlencode(self::TEST_RESOURCE_ID)
26
+        );
27
+        $resource = MessagingProfile::retrieve(self::TEST_RESOURCE_ID);
28
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resource);
29
+    }
30
+
31
+
32
+    public function testIsCreatable()
33
+    {
34
+        $this->expectsRequest(
35
+            'post',
36
+            '/v2/messaging_profiles'
37
+        );
38
+        $resource = MessagingProfile::create(["country" => "US", "type" => "custom"]);
39
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resource);
40
+    }
41
+
42
+    public function testIsUpdatable()
43
+    {
44
+        $this->expectsRequest(
45
+            'patch',
46
+            '/v2/messaging_profiles/' . urlencode(self::TEST_RESOURCE_ID)
47
+        );
48
+        $resource = MessagingProfile::update(self::TEST_RESOURCE_ID, [
49
+            "name" => "Test",
50
+        ]);
51
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resource);
52
+    }
53
+
54
+    public function testIsDeletable()
55
+    {
56
+        $resource = MessagingProfile::retrieve(self::TEST_RESOURCE_ID);
57
+        $this->expectsRequest(
58
+            'delete',
59
+            '/v2/messaging_profiles/' . urlencode(self::TEST_RESOURCE_ID)
60
+        );
61
+        $resource->delete();
62
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resource);
63
+    }
64
+
65
+    public function testCanCallPhoneNumbers()
66
+    {
67
+        $messaging_profile = MessagingProfile::retrieve(self::TEST_RESOURCE_ID);
68
+        $this->expectsRequest(
69
+            'get',
70
+            '/v2/messaging_profiles/' . urlencode(self::TEST_RESOURCE_ID) . '/phone_numbers'
71
+        );
72
+        $resources = $messaging_profile->phone_numbers();
73
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resources);
74
+        $this->assertInstanceOf(\Telnyx\MessagingPhoneNumber::class, $resources[0]);
75
+    }
76
+
77
+    public function testCanCallShortCodes()
78
+    {
79
+        $messaging_profile = MessagingProfile::retrieve(self::TEST_RESOURCE_ID);
80
+        $this->expectsRequest(
81
+            'get',
82
+            '/v2/messaging_profiles/' . urlencode(self::TEST_RESOURCE_ID) . '/short_codes'
83
+        );
84
+        $resources = $messaging_profile->short_codes();
85
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resources);
86
+        $this->assertInstanceOf(\Telnyx\ShortCode::class, $resources[0]);
87
+    }
88
+
89
+
90
+    public function testCanCallAlphanumericSenderIds()
91
+    {
92
+        $messaging_profile = MessagingProfile::retrieve(self::TEST_RESOURCE_ID);
93
+        $this->expectsRequest(
94
+            'get',
95
+            '/v2/messaging_profiles/' . urlencode(self::TEST_RESOURCE_ID) . '/alphanumeric_sender_ids'
96
+        );
97
+        $resources = $messaging_profile->alphanumeric_sender_ids();
98
+        $this->assertInstanceOf(\Telnyx\MessagingProfile::class, $resources);
99
+        $this->assertInstanceOf(\Telnyx\AlphanumericSenderId::class, $resources[0]);
100
+    }
101
+}