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,134 @@
1
+<?php
2
+
3
+namespace Telnyx;
4
+
5
+/**
6
+ * @internal
7
+ * @covers \Telnyx\SimCard
8
+ */
9
+final class SimCardTest extends \Telnyx\TestCase
10
+{
11
+    const TEST_RESOURCE_ID = '6a09cdc3-8948-47f0-aa62-74ac943d6c58';
12
+    
13
+    public function testIsListable()
14
+    {
15
+        $this->expectsRequest(
16
+            'get',
17
+            '/v2/sim_cards'
18
+        );
19
+        $resources = SimCard::all();
20
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
21
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resources['data'][0]);
22
+    }
23
+
24
+    public function testIsRetrievable()
25
+    {
26
+        $this->expectsRequest(
27
+            'get',
28
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID)
29
+        );
30
+        $resource = SimCard::retrieve(self::TEST_RESOURCE_ID);
31
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resource);
32
+    }
33
+
34
+    public function testIsUpdatable()
35
+    {
36
+        $this->expectsRequest(
37
+            'patch',
38
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID)
39
+        );
40
+        $resource = SimCard::update(self::TEST_RESOURCE_ID, [
41
+            "name" => "Test",
42
+        ]);
43
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resource);
44
+    }
45
+
46
+    /*
47
+    public function testActivate()
48
+    {
49
+        $simcard = SimCard::retrieve(self::TEST_RESOURCE_ID);
50
+        $this->expectsRequest(
51
+            'post',
52
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/actions/activate'
53
+        );
54
+        $resources = $simcard->activate();
55
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resources);
56
+    }
57
+
58
+    public function testDeactivate()
59
+    {
60
+        $simcard = SimCard::retrieve(self::TEST_RESOURCE_ID);
61
+        $this->expectsRequest(
62
+            'post',
63
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/actions/deactivate'
64
+        );
65
+        $resources = $simcard->deactivate();
66
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resources);
67
+    }
68
+    */
69
+
70
+    public function testEnable()
71
+    {
72
+        $simcard = SimCard::retrieve(self::TEST_RESOURCE_ID);
73
+        $this->expectsRequest(
74
+            'post',
75
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/actions/enable'
76
+        );
77
+        $resources = $simcard->enable();
78
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resources);
79
+    }
80
+
81
+    public function testDisable()
82
+    {
83
+        $simcard = SimCard::retrieve(self::TEST_RESOURCE_ID);
84
+        $this->expectsRequest(
85
+            'post',
86
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/actions/disable'
87
+        );
88
+        $resources = $simcard->disable();
89
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resources);
90
+    }
91
+
92
+    public function testRegister()
93
+    {
94
+        $this->expectsRequest(
95
+            'post',
96
+            '/v2/actions/register/sim_cards'
97
+        );
98
+        $resources = SimCard::register(["registration_codes" => ["1234567890, 123456332601"]]);
99
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
100
+        $this->assertInstanceOf(\Telnyx\SimCard::class, $resources['data'][0]);
101
+    }
102
+
103
+    public function testDeleteNetworkPreferences()
104
+    {
105
+        $this->expectsRequest(
106
+            'delete',
107
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/network_preferences'
108
+        );
109
+        $resource = SimCard::delete_network_preferences(self::TEST_RESOURCE_ID);
110
+        $this->assertInstanceOf(\Telnyx\TelnyxObject::class, $resource);
111
+    }
112
+
113
+    public function testGetNetworkPreferences()
114
+    {
115
+        $this->expectsRequest(
116
+            'get',
117
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/network_preferences'
118
+        );
119
+        $resource = SimCard::get_network_preferences(self::TEST_RESOURCE_ID);
120
+        $this->assertInstanceOf(\Telnyx\TelnyxObject::class, $resource);
121
+    }
122
+
123
+    public function testSetNetworkPreferences()
124
+    {
125
+        $this->expectsRequest(
126
+            'put',
127
+            '/v2/sim_cards/' . urlencode(self::TEST_RESOURCE_ID) . '/network_preferences'
128
+        );
129
+        $resource = SimCard::set_network_preferences(self::TEST_RESOURCE_ID, [
130
+            'mobile_operator_network_id' => '6a09cdc3-8948-47f0-aa62-74ac943d6c58'
131
+        ]);
132
+        $this->assertInstanceOf(\Telnyx\TelnyxObject::class, $resource);
133
+    }
134
+}