1919use Symfony \Component \Notifier \Message \MessageInterface ;
2020use Symfony \Component \Notifier \Message \SmsMessage ;
2121use Symfony \Component \Notifier \Test \TransportTestCase ;
22+ use Symfony \Component \Notifier \Tests \Fixtures \DummyHttpClient ;
23+ use Symfony \Component \Notifier \Tests \Fixtures \DummyMessage ;
2224use Symfony \Component \Notifier \Transport \TransportInterface ;
2325use Symfony \Contracts \HttpClient \HttpClientInterface ;
2426
@@ -27,25 +29,25 @@ final class SmsapiTransportTest extends TransportTestCase
2729 /**
2830 * @return SmsapiTransport
2931 */
30- public function createTransport (HttpClientInterface $ client = null ): TransportInterface
32+ public static function createTransport (HttpClientInterface $ client = null ): TransportInterface
3133 {
32- return (new SmsapiTransport ('testToken ' , 'testFrom ' , $ client ?? $ this -> createMock (HttpClientInterface::class )))->setHost ('test.host ' );
34+ return (new SmsapiTransport ('testToken ' , 'testFrom ' , $ client ?? new DummyHttpClient ( )))->setHost ('test.host ' );
3335 }
3436
35- public function toStringProvider (): iterable
37+ public static function toStringProvider (): iterable
3638 {
37- yield ['smsapi://test.host?from=testFrom ' , $ this -> createTransport ()];
39+ yield ['smsapi://test.host?from=testFrom ' , self :: createTransport ()];
3840 }
3941
40- public function supportedMessagesProvider (): iterable
42+ public static function supportedMessagesProvider (): iterable
4143 {
4244 yield [new SmsMessage ('0611223344 ' , 'Hello! ' )];
4345 }
4446
45- public function unsupportedMessagesProvider (): iterable
47+ public static function unsupportedMessagesProvider (): iterable
4648 {
4749 yield [new ChatMessage ('Hello! ' )];
48- yield [$ this -> createMock (MessageInterface::class )];
50+ yield [new DummyMessage ( )];
4951 }
5052
5153 public function createClient (int $ statusCode , string $ content ): HttpClientInterface
@@ -75,7 +77,7 @@ public function responseProvider(): iterable
7577 public function testThrowExceptionWhenMessageWasNotSent (int $ statusCode , string $ content , string $ errorMessage )
7678 {
7779 $ client = $ this ->createClient ($ statusCode , $ content );
78- $ transport = $ this -> createTransport ($ client );
80+ $ transport = self :: createTransport ($ client );
7981 $ message = new SmsMessage ('0611223344 ' , 'Hello! ' );
8082
8183 $ this ->expectException (TransportException::class);
0 commit comments