Browse code

added appinfo/info.xml appinfo/signature.json CHANGELOG.txt lib/AppInfo/Application.php css/style.css providers/Plivo

DoubleBastionAdmin authored on 05/11/2025 13:35:09
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,90 @@
1
+<?php
2
+
3
+namespace Plivo\Tests\Resources;
4
+
5
+use Plivo\Http\PlivoRequest;
6
+use Plivo\Http\PlivoResponse;
7
+use Plivo\Tests\BaseTestCase;
8
+
9
+
10
+/**
11
+ * Class VerifyTest
12
+ * @package Plivo\Tests\Resources
13
+ */
14
+
15
+ class VerifyTest extends BaseTestCase {
16
+
17
+    public function testInitiateVerify()
18
+    {
19
+        $request = new PlivoRequest(
20
+            'POST',
21
+            'Account/MAXXXXXXXXXXXXXXXXXX/VerifiedCallerId/',
22
+            [
23
+                "phone_number" => "+919999999999"
24
+            ]);
25
+        $body = file_get_contents(__DIR__ . '/../Mocks/initiateVerifyResponse.json');
26
+
27
+        $this->mock(new PlivoResponse($request,200, $body));
28
+        $actual = $this->client->verifyCallerId->initiate("+919999999999");
29
+        $this->assertRequest($request);
30
+        self::assertNotNull($actual);
31
+    }
32
+
33
+    public function testVerify()
34
+    {   
35
+        $verificationUuid = '605c75f2-02b6-4cb8-883d-69cf37b21e5a';
36
+        $otp = "999999";
37
+        $request = new PlivoRequest(
38
+            'POST',
39
+            'Account/MAXXXXXXXXXXXXXXXXXX/VerifiedCallerId/'.$verificationUuid.'/',
40
+            [
41
+                "otp" => "999999"
42
+            ]);
43
+        $body = file_get_contents(__DIR__ . '/../Mocks/verifyCallerIdResponse.json');
44
+
45
+        $this->mock(new PlivoResponse($request,200, $body));
46
+        $actual = $this->client->verifyCallerId->verify($verificationUuid,$otp);
47
+        self::assertNotNull($actual);
48
+    }
49
+
50
+    public function testUpdateVerifiedCallerId()
51
+    {   
52
+        $phoneNumber = "+919999999999";
53
+        $request = new PlivoRequest(
54
+            'POST',
55
+            'Account/MAXXXXXXXXXXXXXXXXXX/VerifiedCallerId/'.$phoneNumber.'/',
56
+            [
57
+                "alias" => "test-2"
58
+            ]);
59
+        $body = file_get_contents(__DIR__ . '/../Mocks/updateVerifiedCallerIdResponse.json');
60
+
61
+        $this->mock(new PlivoResponse($request,200, $body));
62
+        $actual = $this->client->verifyCallerId->updateVerifiedCallerId($phoneNumber,["alias" => "test"]);
63
+        self::assertNotNull($actual);
64
+    }
65
+
66
+    public function testGetVerifiedCallerId()
67
+    {
68
+        $phoneNumber = "+919999999999";
69
+        $request = new PlivoRequest(
70
+            'GET',
71
+            'Account/MAXXXXXXXXXXXXXXXXXX/VerifiedCallerId/'.$phoneNumber.'/');
72
+        $body = file_get_contents(__DIR__ . '/../Mocks/updateVerifiedCallerIdResponse.json');
73
+        $this->mock(new PlivoResponse($request,200, $body));
74
+        $actual = $this->client->verifyCallerId->getVerifiedCallerId($phoneNumber);
75
+        self::assertNotNull($actual);
76
+    }
77
+
78
+    public function testListVerifiedCallerId()
79
+    {
80
+        $request = new PlivoRequest(
81
+            'GET',
82
+            'Account/MAXXXXXXXXXXXXXXXXXX/VerifiedCallerId/');
83
+        $body = file_get_contents(__DIR__ . '/../Mocks/listVerifiedCallerIdResponse.json');
84
+        $this->mock(new PlivoResponse($request,200, $body));
85
+        $actual = $this->client->verifyCallerId->listVerifiedCallerIds();
86
+        $this->assertRequest($request);
87
+        self::assertNotNull($actual);
88
+    }
89
+ 
90
+}