1
1
<?php
2
+
2
3
/*
3
4
* This file is part of the Symfony package.
4
5
*
22
23
23
24
final class PlivoTransportTest extends TransportTestCase
24
25
{
25
- public function createTransport (HttpClientInterface $ client = null , string $ from = 'from ' ): PlivoTransport {
26
+ public function createTransport (HttpClientInterface $ client = null , string $ from = 'from ' ): PlivoTransport
27
+ {
26
28
return new PlivoTransport ('authId ' , 'authToken ' , $ from , $ client ?? $ this ->createMock (HttpClientInterface::class));
27
29
}
28
30
@@ -42,7 +44,7 @@ public function supportedMessagesProvider(): iterable
42
44
/**
43
45
* @dataProvider invalidFromProvider
44
46
*/
45
- public function testInvalidArgumentExceptionIsThrownIfFromIsInvalid (string $ from ): void
47
+ public function testInvalidArgumentExceptionIsThrownIfFromIsInvalid (string $ from )
46
48
{
47
49
$ transport = $ this ->createTransport (null , $ from );
48
50
@@ -55,18 +57,18 @@ public function testInvalidArgumentExceptionIsThrownIfFromIsInvalid(string $from
55
57
/**
56
58
* @dataProvider validFromProvider
57
59
*/
58
- public function testNoInvalidArgumentExceptionIsThrownIfFromIsValid (string $ from ): void
60
+ public function testNoInvalidArgumentExceptionIsThrownIfFromIsValid (string $ from )
59
61
{
60
62
$ message = new SmsMessage ('+33612345678 ' , 'Hello! ' );
61
63
$ response = $ this ->createMock (ResponseInterface::class);
62
64
$ response ->expects (self ::exactly (2 ))->method ('getStatusCode ' )->willReturn (202 );
63
- $ response ->expects (self ::once ())->method ('getContent ' )->willReturn (json_encode (['message ' => 'message(s) queued ' , 'message_uuid ' => ['foo ' ], 'api_id ' => 'bar ' , ]));
65
+ $ response ->expects (self ::once ())->method ('getContent ' )->willReturn (json_encode (['message ' => 'message(s) queued ' , 'message_uuid ' => ['foo ' ], 'api_id ' => 'bar ' ]));
64
66
$ client = new MockHttpClient (function (string $ method , string $ url ) use ($ response ): ResponseInterface {
65
- self ::assertSame ('POST ' , $ method );
66
- self ::assertSame ('https://api.plivo.com/v1/Account/authId/Message/ ' , $ url );
67
+ self ::assertSame ('POST ' , $ method );
68
+ self ::assertSame ('https://api.plivo.com/v1/Account/authId/Message/ ' , $ url );
67
69
68
- return $ response ;
69
- }
70
+ return $ response ;
71
+ }
70
72
);
71
73
$ transport = $ this ->createTransport ($ client , $ from );
72
74
$ sentMessage = $ transport ->send ($ message );
0 commit comments