1414use Symfony \Component \HttpClient \MockHttpClient ;
1515use Symfony \Component \Notifier \Bridge \GatewayApi \GatewayApiTransport ;
1616use Symfony \Component \Notifier \Message \ChatMessage ;
17- use Symfony \Component \Notifier \Message \MessageInterface ;
1817use Symfony \Component \Notifier \Message \SentMessage ;
1918use Symfony \Component \Notifier \Message \SmsMessage ;
2019use Symfony \Component \Notifier \Test \TransportTestCase ;
20+ use Symfony \Component \Notifier \Tests \Fixtures \DummyHttpClient ;
21+ use Symfony \Component \Notifier \Tests \Fixtures \DummyMessage ;
2122use Symfony \Component \Notifier \Transport \TransportInterface ;
2223use Symfony \Contracts \HttpClient \HttpClientInterface ;
2324use Symfony \Contracts \HttpClient \ResponseInterface ;
@@ -31,25 +32,25 @@ final class GatewayApiTransportTest extends TransportTestCase
3132 /**
3233 * @return GatewayApiTransport
3334 */
34- public function createTransport (HttpClientInterface $ client = null ): TransportInterface
35+ public static function createTransport (HttpClientInterface $ client = null ): TransportInterface
3536 {
36- return new GatewayApiTransport ('authtoken ' , 'Symfony ' , $ client ?? $ this -> createMock (HttpClientInterface::class ));
37+ return new GatewayApiTransport ('authtoken ' , 'Symfony ' , $ client ?? new DummyHttpClient ( ));
3738 }
3839
39- public function toStringProvider (): iterable
40+ public static function toStringProvider (): iterable
4041 {
41- yield ['gatewayapi://gatewayapi.com?from=Symfony ' , $ this -> createTransport ()];
42+ yield ['gatewayapi://gatewayapi.com?from=Symfony ' , self :: createTransport ()];
4243 }
4344
44- public function supportedMessagesProvider (): iterable
45+ public static function supportedMessagesProvider (): iterable
4546 {
4647 yield [new SmsMessage ('0611223344 ' , 'Hello! ' )];
4748 }
4849
49- public function unsupportedMessagesProvider (): iterable
50+ public static function unsupportedMessagesProvider (): iterable
5051 {
5152 yield [new ChatMessage ('Hello! ' )];
52- yield [$ this -> createMock (MessageInterface::class )];
53+ yield [new DummyMessage ( )];
5354 }
5455
5556 public function testSend ()
@@ -68,7 +69,7 @@ public function testSend()
6869
6970 $ message = new SmsMessage ('3333333333 ' , 'Hello! ' );
7071
71- $ transport = $ this -> createTransport ($ client );
72+ $ transport = self :: createTransport ($ client );
7273 $ sentMessage = $ transport ->send ($ message );
7374
7475 $ this ->assertInstanceOf (SentMessage::class, $ sentMessage );
0 commit comments