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,62 @@
1
+<?php
2
+
3
+namespace Telnyx;
4
+
5
+/**
6
+ * @internal
7
+ * @covers \Telnyx\Verification
8
+ */
9
+final class VerificationTest extends \Telnyx\TestCase
10
+{
11
+    const TEST_RESOURCE_ID = '12ade33a-21c0-473b-b055-b3c836e1c292';
12
+    const TEST_PHONE_NUMBER = '+13035551234';
13
+    const TEST_VERIFICATION_CODE = '17686';
14
+
15
+    /*
16
+    public function testIsCreatable()
17
+    {
18
+        $this->expectsRequest(
19
+            'post',
20
+            '/v2/verifications'
21
+        );
22
+        $resource = Verification::create([
23
+            "verify_profile_id" => self::TEST_RESOURCE_ID,
24
+            "phone_number" => self::TEST_PHONE_NUMBER,
25
+            "type" => "sms"
26
+        ]);
27
+        $this->assertInstanceOf(\Telnyx\Verification::class, $resource);
28
+    }
29
+    */
30
+
31
+    public function testIsRetrievable()
32
+    {
33
+        $this->expectsRequest(
34
+            'get',
35
+            '/v2/verifications/' . urlencode(self::TEST_RESOURCE_ID)
36
+        );
37
+        $resource = Verification::retrieve(self::TEST_RESOURCE_ID);
38
+        $this->assertInstanceOf(\Telnyx\Verification::class, $resource);
39
+    }
40
+
41
+    public function testRetrieveByPhoneNumber()
42
+    {
43
+        $this->expectsRequest(
44
+            'get',
45
+            '/v2/verifications/by_phone_number/' . urlencode(self::TEST_PHONE_NUMBER)
46
+        );
47
+        $resource = Verification::retrieve_by_phone_number(self::TEST_PHONE_NUMBER);
48
+        $this->assertInstanceOf(\Telnyx\Collection::class, $resource);
49
+        $this->assertInstanceOf(\Telnyx\Verification::class, $resource['data'][0]);
50
+    }
51
+
52
+    public function testSubmitVerification()
53
+    {
54
+        $this->expectsRequest(
55
+            'post',
56
+            '/v2/verifications/by_phone_number/' . urlencode(self::TEST_PHONE_NUMBER) . '/actions/verify'
57
+        );
58
+        $resource = Verification::submit_verification(self::TEST_PHONE_NUMBER, self::TEST_VERIFICATION_CODE);
59
+        $this->assertInstanceOf(\Telnyx\TelnyxObject::class, $resource);
60
+    }
61
+
62
+}