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,91 @@
1
+<?php
2
+
3
+namespace Telnyx;
4
+
5
+/**
6
+ * @internal
7
+ * @covers \Telnyx\PortingOrder
8
+ */
9
+final class PortingOrderTest extends \Telnyx\TestCase
10
+{
11
+    const TEST_RESOURCE_ID = 'f1486bae-f067-460c-ad43-73a92848f902';
12
+    
13
+    public function testIsListable()
14
+    {
15
+        $this->expectsRequest(
16
+            'get',
17
+            '/v2/porting_orders'
18
+        );
19
+        $resources = PortingOrder::all();
20
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
21
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resources['data'][0]);
22
+    }
23
+
24
+    public function testIsCreatable()
25
+    {
26
+        $this->expectsRequest(
27
+            'post',
28
+            '/v2/porting_orders'
29
+        );
30
+        $resources = PortingOrder::create(["phone_numbers" => ["+13035550000","+13035550001","+13035550002"]]);
31
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resources);
32
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resources['data'][0]);
33
+    }
34
+
35
+    public function testIsRetrievable()
36
+    {
37
+        $this->expectsRequest(
38
+            'get',
39
+            '/v2/porting_orders/' . urlencode(self::TEST_RESOURCE_ID)
40
+        );
41
+        $resource = PortingOrder::retrieve(self::TEST_RESOURCE_ID);
42
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resource);
43
+    }
44
+
45
+    public function testIsUpdatable()
46
+    {
47
+        $this->expectsRequest(
48
+            'patch',
49
+            '/v2/porting_orders/' . urlencode(self::TEST_RESOURCE_ID)
50
+        );
51
+        $resource = PortingOrder::update(self::TEST_RESOURCE_ID, ["customer_reference" => "string"]);
52
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resource);
53
+    }
54
+
55
+    public function testIsDeletable()
56
+    {
57
+        $resource = PortingOrder::retrieve(self::TEST_RESOURCE_ID);
58
+        $this->expectsRequest(
59
+            'delete',
60
+            '/v2/porting_orders/' . urlencode(self::TEST_RESOURCE_ID)
61
+        );
62
+        $resource->delete();
63
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resource);
64
+    }
65
+
66
+    /*
67
+    Note: Currently in beta
68
+    public function testLoaTemplate()
69
+    {
70
+        $PortingOrder = PortingOrder::retrieve(self::TEST_RESOURCE_ID);
71
+        $this->expectsRequest(
72
+            'get',
73
+            '/v2/porting_orders/' . urlencode(self::TEST_RESOURCE_ID) . '/loa_template'
74
+        );
75
+        $resources = $PortingOrder->loa_template();
76
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resources);
77
+    }
78
+    */
79
+
80
+    public function testConfirm()
81
+    {
82
+        $PortingOrder = PortingOrder::retrieve(self::TEST_RESOURCE_ID);
83
+        $this->expectsRequest(
84
+            'post',
85
+            '/v2/porting_orders/' . urlencode(self::TEST_RESOURCE_ID) . '/actions/confirm'
86
+        );
87
+        $resources = $PortingOrder->confirm();
88
+        $this->assertInstanceOf(\Telnyx\PortingOrder::class, $resources);
89
+    }
90
+
91
+}