| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,223 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Plivo\Tests\Resources; |
|
| 4 |
+ |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+use Plivo\Http\PlivoRequest; |
|
| 9 |
+use Plivo\Http\PlivoResponse; |
|
| 10 |
+use Plivo\Tests\BaseTestCase; |
|
| 11 |
+ |
|
| 12 |
+ |
|
| 13 |
+/** |
|
| 14 |
+ * Class MessageTest |
|
| 15 |
+ * @package Plivo\Tests\Resources |
|
| 16 |
+ */ |
|
| 17 |
+class MessageTest extends BaseTestCase {
|
|
| 18 |
+ |
|
| 19 |
+ public function testMessageCreateWithoutSrcPowerpackException() |
|
| 20 |
+ {
|
|
| 21 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoValidationException');
|
|
| 22 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 23 |
+ |
|
| 24 |
+ $this->mock(new PlivoResponse(new PlivoRequest(),200, $body)); |
|
| 25 |
+ |
|
| 26 |
+ $this->client->messages->create(null, ["+919012345678"], "Test", [], null); |
|
| 27 |
+ |
|
| 28 |
+ } |
|
| 29 |
+ |
|
| 30 |
+ public function testMessageCreateWithSrcPowerpackException() |
|
| 31 |
+ {
|
|
| 32 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoValidationException');
|
|
| 33 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 34 |
+ |
|
| 35 |
+ $this->mock(new PlivoResponse(new PlivoRequest(),200, $body)); |
|
| 36 |
+ |
|
| 37 |
+ $this->client->messages->create("+919999999999", ["+919012345678"], "Test", [], "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
| 38 |
+ |
|
| 39 |
+ } |
|
| 40 |
+ |
|
| 41 |
+ public function testMessageCreate() |
|
| 42 |
+ {
|
|
| 43 |
+ $request = new PlivoRequest( |
|
| 44 |
+ 'POST', |
|
| 45 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 46 |
+ [ |
|
| 47 |
+ "dst" => "+919012345678", |
|
| 48 |
+ "text" => "Test", |
|
| 49 |
+ "src" => "+919999999999" |
|
| 50 |
+ ]); |
|
| 51 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 52 |
+ |
|
| 53 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 54 |
+ |
|
| 55 |
+ $actual = $this->client->messages->create("+919999999999", ["+919012345678"], "Test", [], null);
|
|
| 56 |
+ |
|
| 57 |
+ self::assertNotNull($actual); |
|
| 58 |
+ } |
|
| 59 |
+ |
|
| 60 |
+ public function testnewMessageCreate() |
|
| 61 |
+ {
|
|
| 62 |
+ $request = new PlivoRequest( |
|
| 63 |
+ 'POST', |
|
| 64 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 65 |
+ [ |
|
| 66 |
+ "dst" => "+919012345678", |
|
| 67 |
+ "text" => "Test", |
|
| 68 |
+ "src" => "+919999999999" |
|
| 69 |
+ ]); |
|
| 70 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 71 |
+ |
|
| 72 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 73 |
+ |
|
| 74 |
+ $actual = $this->client->messages->create([ "src" => "+919999999999", "dst" => "+919012345678", "text" =>"Test"]); |
|
| 75 |
+ |
|
| 76 |
+ self::assertNotNull($actual); |
|
| 77 |
+ } |
|
| 78 |
+ |
|
| 79 |
+ public function testwhatsappTemplateMessageCreate() |
|
| 80 |
+ {
|
|
| 81 |
+ $request = new PlivoRequest( |
|
| 82 |
+ 'POST', |
|
| 83 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 84 |
+ [ |
|
| 85 |
+ "dst" => "+919012345678", |
|
| 86 |
+ "text" => "Test", |
|
| 87 |
+ "src" => "+919999999999" |
|
| 88 |
+ ]); |
|
| 89 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 90 |
+ |
|
| 91 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 92 |
+ |
|
| 93 |
+ $template = '{
|
|
| 94 |
+ "name": "hello_world", |
|
| 95 |
+ "language": "en_US", |
|
| 96 |
+ "components": null |
|
| 97 |
+ }'; |
|
| 98 |
+ |
|
| 99 |
+ $actual = $this->client->messages->create([ "src" => "+919999999999", "dst" => "+919012345678", "template" =>$template]); |
|
| 100 |
+ |
|
| 101 |
+ self::assertNotNull($actual); |
|
| 102 |
+ } |
|
| 103 |
+ |
|
| 104 |
+ public function testMessageGet() |
|
| 105 |
+ {
|
|
| 106 |
+ $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 107 |
+ $requesterIP = "192.168.1.1"; |
|
| 108 |
+ $dltEntityID = "1234"; |
|
| 109 |
+ $dltTemplateID = "5678"; |
|
| 110 |
+ $dltTemplateCategory = "service_implicit"; |
|
| 111 |
+ $conversationID = "9876"; |
|
| 112 |
+ $conversationOrigin = "utility"; |
|
| 113 |
+ $conversationExpirationTimestamp = "2023-08-03 23:02:00+05:30"; |
|
| 114 |
+ $request = new PlivoRequest( |
|
| 115 |
+ 'GET', |
|
| 116 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/', |
|
| 117 |
+ []); |
|
| 118 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageGetResponse.json'); |
|
| 119 |
+ |
|
| 120 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 121 |
+ |
|
| 122 |
+ $actual = $this->client->messages->get($messageUuid); |
|
| 123 |
+ |
|
| 124 |
+ $this->assertRequest($request); |
|
| 125 |
+ |
|
| 126 |
+ self::assertNotNull($actual); |
|
| 127 |
+ |
|
| 128 |
+ self::assertEquals($actual->messageUuid, $messageUuid); |
|
| 129 |
+ self::assertEquals($actual->requesterIP, $requesterIP); |
|
| 130 |
+ self::assertEquals($actual->dltEntityID, $dltEntityID); |
|
| 131 |
+ self::assertEquals($actual->dltTemplateID, $dltTemplateID); |
|
| 132 |
+ self::assertEquals($actual->dltTemplateCategory, $dltTemplateCategory); |
|
| 133 |
+ self::assertEquals($actual->conversationID, $conversationID); |
|
| 134 |
+ self::assertEquals($actual->conversationOrigin, $conversationOrigin); |
|
| 135 |
+ self::assertEquals($actual->conversationExpirationTimestamp, $conversationExpirationTimestamp); |
|
| 136 |
+ } |
|
| 137 |
+ |
|
| 138 |
+ public function testMessageGetwithPowerpack() |
|
| 139 |
+ {
|
|
| 140 |
+ $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 141 |
+ $expected_ppk = "15c01cc2-4b9f-4d3b-bd15-3c4b38984cc4"; |
|
| 142 |
+ $request = new PlivoRequest( |
|
| 143 |
+ 'GET', |
|
| 144 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/', |
|
| 145 |
+ []); |
|
| 146 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageGetResponse.json'); |
|
| 147 |
+ |
|
| 148 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 149 |
+ |
|
| 150 |
+ $actual = $this->client->messages->get($messageUuid); |
|
| 151 |
+ |
|
| 152 |
+ self::assertEquals($actual->powerpackID, $expected_ppk); |
|
| 153 |
+ } |
|
| 154 |
+ public function testMediaList() |
|
| 155 |
+ {
|
|
| 156 |
+ $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 157 |
+ $request = new PlivoRequest( |
|
| 158 |
+ 'GET', |
|
| 159 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/', |
|
| 160 |
+ []); |
|
| 161 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageGetResponse.json'); |
|
| 162 |
+ |
|
| 163 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 164 |
+ |
|
| 165 |
+ $actual = $this->client->messages->get($messageUuid); |
|
| 166 |
+ $request = new PlivoRequest( |
|
| 167 |
+ 'GET', |
|
| 168 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/Media/', |
|
| 169 |
+ []); |
|
| 170 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/mediaListResponse.json'); |
|
| 171 |
+ |
|
| 172 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 173 |
+ |
|
| 174 |
+ $mediaList = $actual->listMedia(); |
|
| 175 |
+ self::assertNotNull($mediaList); |
|
| 176 |
+ |
|
| 177 |
+ } |
|
| 178 |
+ |
|
| 179 |
+ function testMessageList() |
|
| 180 |
+ {
|
|
| 181 |
+ $requesterIP1 = "192.168.1.1"; |
|
| 182 |
+ $requesterIP2 = "192.168.1.20"; |
|
| 183 |
+ $dltEntityID = "9876"; |
|
| 184 |
+ $dltTemplateID = "5432"; |
|
| 185 |
+ $dltTemplateCategory = "promotional"; |
|
| 186 |
+ $conversationID = "1234"; |
|
| 187 |
+ $conversationOrigin = "service"; |
|
| 188 |
+ $conversationExpirationTimestamp = "2023-08-03 23:02:00+05:30"; |
|
| 189 |
+ $request = new PlivoRequest( |
|
| 190 |
+ 'Get', |
|
| 191 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 192 |
+ []); |
|
| 193 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageListResponse.json'); |
|
| 194 |
+ |
|
| 195 |
+ $this->mock(new PlivoResponse($request,202, $body)); |
|
| 196 |
+ |
|
| 197 |
+ $actual = $this->client->messages->list; |
|
| 198 |
+ |
|
| 199 |
+ $this->assertRequest($request); |
|
| 200 |
+ |
|
| 201 |
+ self::assertNotNull($actual); |
|
| 202 |
+ self::assertEquals($actual->resources[0]->requesterIP, $requesterIP1); |
|
| 203 |
+ self::assertEquals($actual->resources[19]->requesterIP, $requesterIP2); |
|
| 204 |
+ |
|
| 205 |
+ self::assertEquals($actual->resources[0]->dltEntityID, $dltEntityID); |
|
| 206 |
+ self::assertEquals($actual->resources[0]->dltTemplateID, $dltTemplateID); |
|
| 207 |
+ self::assertEquals($actual->resources[0]->dltTemplateCategory, $dltTemplateCategory); |
|
| 208 |
+ |
|
| 209 |
+ self::assertEquals($actual->resources[0]->conversationID, $conversationID); |
|
| 210 |
+ self::assertEquals($actual->resources[0]->conversationOrigin, $conversationOrigin); |
|
| 211 |
+ self::assertEquals($actual->resources[0]->conversationExpirationTimestamp, $conversationExpirationTimestamp); |
|
| 212 |
+ |
|
| 213 |
+ self::assertObjectNotHasAttribute('dltEntityID', $actual->resources[19]);
|
|
| 214 |
+ self::assertObjectNotHasAttribute('dltTemplateID', $actual->resources[19]);
|
|
| 215 |
+ self::assertObjectNotHasAttribute('dltTemplateCategory', $actual->resources[19]);
|
|
| 216 |
+ |
|
| 217 |
+ self::assertObjectNotHasAttribute('conversationID', $actual->resources[19]);
|
|
| 218 |
+ self::assertObjectNotHasAttribute('conversationOrigin', $actual->resources[19]);
|
|
| 219 |
+ self::assertObjectNotHasAttribute('conversationExpirationTimestamp', $actual->resources[19]);
|
|
| 220 |
+ |
|
| 221 |
+ } |
|
| 222 |
+ |
|
| 223 |
+} |
|
| 0 | 224 |
\ No newline at end of file |
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,118 +0,0 @@ |
| 1 |
-<?php |
|
| 2 |
- |
|
| 3 |
-namespace Plivo\Tests\Resources; |
|
| 4 |
- |
|
| 5 |
- |
|
| 6 |
- |
|
| 7 |
- |
|
| 8 |
-use Plivo\Http\PlivoRequest; |
|
| 9 |
-use Plivo\Http\PlivoResponse; |
|
| 10 |
-use Plivo\Tests\BaseTestCase; |
|
| 11 |
- |
|
| 12 |
- |
|
| 13 |
-/** |
|
| 14 |
- * Class MessageTest |
|
| 15 |
- * @package Plivo\Tests\Resources |
|
| 16 |
- */ |
|
| 17 |
-class MessageTest extends BaseTestCase {
|
|
| 18 |
- |
|
| 19 |
- public function testMessageCreateWithoutSrcPowerpackException() |
|
| 20 |
- {
|
|
| 21 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoValidationException');
|
|
| 22 |
- $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 23 |
- |
|
| 24 |
- $this->mock(new PlivoResponse(new PlivoRequest(),200, $body)); |
|
| 25 |
- |
|
| 26 |
- $this->client->messages->create(null, ["+919012345678"], "Test", [], null); |
|
| 27 |
- |
|
| 28 |
- } |
|
| 29 |
- |
|
| 30 |
- public function testMessageCreateWithSrcPowerpackException() |
|
| 31 |
- {
|
|
| 32 |
- $this->expectPlivoException('Plivo\Exceptions\PlivoValidationException');
|
|
| 33 |
- $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 34 |
- |
|
| 35 |
- $this->mock(new PlivoResponse(new PlivoRequest(),200, $body)); |
|
| 36 |
- |
|
| 37 |
- $this->client->messages->create("+919999999999", ["+919012345678"], "Test", [], "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
| 38 |
- |
|
| 39 |
- } |
|
| 40 |
- |
|
| 41 |
- public function testMessageCreate() |
|
| 42 |
- {
|
|
| 43 |
- $request = new PlivoRequest( |
|
| 44 |
- 'POST', |
|
| 45 |
- 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 46 |
- [ |
|
| 47 |
- "dst" => "+919012345678", |
|
| 48 |
- "text" => "Test", |
|
| 49 |
- "src" => "+919999999999" |
|
| 50 |
- ]); |
|
| 51 |
- $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 52 |
- |
|
| 53 |
- $this->mock(new PlivoResponse($request,200, $body)); |
|
| 54 |
- |
|
| 55 |
- $actual = $this->client->messages->create("+919999999999", ["+919012345678"], "Test");
|
|
| 56 |
- |
|
| 57 |
- $this->assertRequest($request); |
|
| 58 |
- |
|
| 59 |
- self::assertNotNull($actual); |
|
| 60 |
- } |
|
| 61 |
- |
|
| 62 |
- public function testMessageGet() |
|
| 63 |
- {
|
|
| 64 |
- $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 65 |
- $request = new PlivoRequest( |
|
| 66 |
- 'GET', |
|
| 67 |
- 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/', |
|
| 68 |
- []); |
|
| 69 |
- $body = file_get_contents(__DIR__ . '/../Mocks/messageGetResponse.json'); |
|
| 70 |
- |
|
| 71 |
- $this->mock(new PlivoResponse($request,200, $body)); |
|
| 72 |
- |
|
| 73 |
- $actual = $this->client->messages->get($messageUuid); |
|
| 74 |
- |
|
| 75 |
- $this->assertRequest($request); |
|
| 76 |
- |
|
| 77 |
- self::assertNotNull($actual); |
|
| 78 |
- |
|
| 79 |
- self::assertEquals($actual->messageUuid, $messageUuid); |
|
| 80 |
- } |
|
| 81 |
- |
|
| 82 |
- public function testMediaList() |
|
| 83 |
- {
|
|
| 84 |
- $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 85 |
- $request = new PlivoRequest( |
|
| 86 |
- 'GET', |
|
| 87 |
- 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/Media/', |
|
| 88 |
- []); |
|
| 89 |
- $body = file_get_contents(__DIR__ . '/../Mocks/mediaListResponse.json'); |
|
| 90 |
- |
|
| 91 |
- $this->mock(new PlivoResponse($request,200, $body)); |
|
| 92 |
- |
|
| 93 |
- $actual = $this->client->messages->get($messageUuid).listMedia(); |
|
| 94 |
- |
|
| 95 |
- $this->assertRequest($request); |
|
| 96 |
- |
|
| 97 |
- self::assertNotNull($actual); |
|
| 98 |
- |
|
| 99 |
- } |
|
| 100 |
- |
|
| 101 |
- function testMessageList() |
|
| 102 |
- {
|
|
| 103 |
- $request = new PlivoRequest( |
|
| 104 |
- 'Get', |
|
| 105 |
- 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 106 |
- []); |
|
| 107 |
- $body = file_get_contents(__DIR__ . '/../Mocks/messageListResponse.json'); |
|
| 108 |
- |
|
| 109 |
- $this->mock(new PlivoResponse($request,202, $body)); |
|
| 110 |
- |
|
| 111 |
- $actual = $this->client->messages->list; |
|
| 112 |
- |
|
| 113 |
- $this->assertRequest($request); |
|
| 114 |
- |
|
| 115 |
- self::assertNotNull($actual); |
|
| 116 |
- } |
|
| 117 |
- |
|
| 118 |
-} |
|
| 119 | 0 |
\ No newline at end of file |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,118 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+namespace Plivo\Tests\Resources; |
|
| 4 |
+ |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+use Plivo\Http\PlivoRequest; |
|
| 9 |
+use Plivo\Http\PlivoResponse; |
|
| 10 |
+use Plivo\Tests\BaseTestCase; |
|
| 11 |
+ |
|
| 12 |
+ |
|
| 13 |
+/** |
|
| 14 |
+ * Class MessageTest |
|
| 15 |
+ * @package Plivo\Tests\Resources |
|
| 16 |
+ */ |
|
| 17 |
+class MessageTest extends BaseTestCase {
|
|
| 18 |
+ |
|
| 19 |
+ public function testMessageCreateWithoutSrcPowerpackException() |
|
| 20 |
+ {
|
|
| 21 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoValidationException');
|
|
| 22 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 23 |
+ |
|
| 24 |
+ $this->mock(new PlivoResponse(new PlivoRequest(),200, $body)); |
|
| 25 |
+ |
|
| 26 |
+ $this->client->messages->create(null, ["+919012345678"], "Test", [], null); |
|
| 27 |
+ |
|
| 28 |
+ } |
|
| 29 |
+ |
|
| 30 |
+ public function testMessageCreateWithSrcPowerpackException() |
|
| 31 |
+ {
|
|
| 32 |
+ $this->expectPlivoException('Plivo\Exceptions\PlivoValidationException');
|
|
| 33 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 34 |
+ |
|
| 35 |
+ $this->mock(new PlivoResponse(new PlivoRequest(),200, $body)); |
|
| 36 |
+ |
|
| 37 |
+ $this->client->messages->create("+919999999999", ["+919012345678"], "Test", [], "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
| 38 |
+ |
|
| 39 |
+ } |
|
| 40 |
+ |
|
| 41 |
+ public function testMessageCreate() |
|
| 42 |
+ {
|
|
| 43 |
+ $request = new PlivoRequest( |
|
| 44 |
+ 'POST', |
|
| 45 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 46 |
+ [ |
|
| 47 |
+ "dst" => "+919012345678", |
|
| 48 |
+ "text" => "Test", |
|
| 49 |
+ "src" => "+919999999999" |
|
| 50 |
+ ]); |
|
| 51 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageSendResponse.json'); |
|
| 52 |
+ |
|
| 53 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 54 |
+ |
|
| 55 |
+ $actual = $this->client->messages->create("+919999999999", ["+919012345678"], "Test");
|
|
| 56 |
+ |
|
| 57 |
+ $this->assertRequest($request); |
|
| 58 |
+ |
|
| 59 |
+ self::assertNotNull($actual); |
|
| 60 |
+ } |
|
| 61 |
+ |
|
| 62 |
+ public function testMessageGet() |
|
| 63 |
+ {
|
|
| 64 |
+ $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 65 |
+ $request = new PlivoRequest( |
|
| 66 |
+ 'GET', |
|
| 67 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/', |
|
| 68 |
+ []); |
|
| 69 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageGetResponse.json'); |
|
| 70 |
+ |
|
| 71 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 72 |
+ |
|
| 73 |
+ $actual = $this->client->messages->get($messageUuid); |
|
| 74 |
+ |
|
| 75 |
+ $this->assertRequest($request); |
|
| 76 |
+ |
|
| 77 |
+ self::assertNotNull($actual); |
|
| 78 |
+ |
|
| 79 |
+ self::assertEquals($actual->messageUuid, $messageUuid); |
|
| 80 |
+ } |
|
| 81 |
+ |
|
| 82 |
+ public function testMediaList() |
|
| 83 |
+ {
|
|
| 84 |
+ $messageUuid = "5b40a428-bfc7-4daf-9d06-726c558bf3b8"; |
|
| 85 |
+ $request = new PlivoRequest( |
|
| 86 |
+ 'GET', |
|
| 87 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/'.$messageUuid.'/Media/', |
|
| 88 |
+ []); |
|
| 89 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/mediaListResponse.json'); |
|
| 90 |
+ |
|
| 91 |
+ $this->mock(new PlivoResponse($request,200, $body)); |
|
| 92 |
+ |
|
| 93 |
+ $actual = $this->client->messages->get($messageUuid).listMedia(); |
|
| 94 |
+ |
|
| 95 |
+ $this->assertRequest($request); |
|
| 96 |
+ |
|
| 97 |
+ self::assertNotNull($actual); |
|
| 98 |
+ |
|
| 99 |
+ } |
|
| 100 |
+ |
|
| 101 |
+ function testMessageList() |
|
| 102 |
+ {
|
|
| 103 |
+ $request = new PlivoRequest( |
|
| 104 |
+ 'Get', |
|
| 105 |
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Message/', |
|
| 106 |
+ []); |
|
| 107 |
+ $body = file_get_contents(__DIR__ . '/../Mocks/messageListResponse.json'); |
|
| 108 |
+ |
|
| 109 |
+ $this->mock(new PlivoResponse($request,202, $body)); |
|
| 110 |
+ |
|
| 111 |
+ $actual = $this->client->messages->list; |
|
| 112 |
+ |
|
| 113 |
+ $this->assertRequest($request); |
|
| 114 |
+ |
|
| 115 |
+ self::assertNotNull($actual); |
|
| 116 |
+ } |
|
| 117 |
+ |
|
| 118 |
+} |
|
| 0 | 119 |
\ No newline at end of file |