21
21
use Symfony \Component \Notifier \Message \SmsMessage ;
22
22
use Symfony \Component \Notifier \Notification \Notification ;
23
23
use Symfony \Component \Notifier \Test \TransportTestCase ;
24
+ use Symfony \Component \Notifier \Tests \Fixtures \DummyHttpClient ;
25
+ use Symfony \Component \Notifier \Tests \Fixtures \DummyMessage ;
24
26
use Symfony \Component \Notifier \Transport \TransportInterface ;
25
27
use Symfony \Contracts \HttpClient \HttpClientInterface ;
26
28
use Symfony \Contracts \HttpClient \ResponseInterface ;
@@ -30,25 +32,25 @@ final class LinkedInTransportTest extends TransportTestCase
30
32
/**
31
33
* @return LinkedInTransport
32
34
*/
33
- public function createTransport (HttpClientInterface $ client = null ): TransportInterface
35
+ public static function createTransport (HttpClientInterface $ client = null ): TransportInterface
34
36
{
35
- return (new LinkedInTransport ('AuthToken ' , 'AccountId ' , $ client ?? $ this -> createMock (HttpClientInterface::class )))->setHost ('host.test ' );
37
+ return (new LinkedInTransport ('AuthToken ' , 'AccountId ' , $ client ?? new DummyHttpClient ( )))->setHost ('host.test ' );
36
38
}
37
39
38
- public function toStringProvider (): iterable
40
+ public static function toStringProvider (): iterable
39
41
{
40
- yield ['linkedin://host.test ' , $ this -> createTransport ()];
42
+ yield ['linkedin://host.test ' , self :: createTransport ()];
41
43
}
42
44
43
- public function supportedMessagesProvider (): iterable
45
+ public static function supportedMessagesProvider (): iterable
44
46
{
45
47
yield [new ChatMessage ('Hello! ' )];
46
48
}
47
49
48
- public function unsupportedMessagesProvider (): iterable
50
+ public static function unsupportedMessagesProvider (): iterable
49
51
{
50
52
yield [new SmsMessage ('0611223344 ' , 'Hello! ' )];
51
- yield [$ this -> createMock (MessageInterface::class )];
53
+ yield [new DummyMessage ( )];
52
54
}
53
55
54
56
public function testSendWithEmptyArrayResponseThrowsTransportException ()
@@ -65,7 +67,7 @@ public function testSendWithEmptyArrayResponseThrowsTransportException()
65
67
return $ response ;
66
68
});
67
69
68
- $ transport = $ this -> createTransport ($ client );
70
+ $ transport = self :: createTransport ($ client );
69
71
70
72
$ this ->expectException (TransportException::class);
71
73
@@ -90,7 +92,7 @@ public function testSendWithErrorResponseThrowsTransportException()
90
92
return $ response ;
91
93
});
92
94
93
- $ transport = $ this -> createTransport ($ client );
95
+ $ transport = self :: createTransport ($ client );
94
96
95
97
$ transport ->send (new ChatMessage ('testMessage ' ));
96
98
}
@@ -134,7 +136,7 @@ public function testSendWithOptions()
134
136
135
137
return $ response ;
136
138
});
137
- $ transport = $ this -> createTransport ($ client );
139
+ $ transport = self :: createTransport ($ client );
138
140
139
141
$ transport ->send (new ChatMessage ($ message ));
140
142
}
@@ -182,7 +184,7 @@ public function testSendWithNotification()
182
184
return $ response ;
183
185
});
184
186
185
- $ transport = $ this -> createTransport ($ client );
187
+ $ transport = self :: createTransport ($ client );
186
188
187
189
$ transport ->send ($ chatMessage );
188
190
}
@@ -195,7 +197,7 @@ public function testSendWithInvalidOptions()
195
197
return $ this ->createMock (ResponseInterface::class);
196
198
});
197
199
198
- $ transport = $ this -> createTransport ($ client );
200
+ $ transport = self :: createTransport ($ client );
199
201
200
202
$ transport ->send (new ChatMessage ('testMessage ' , $ this ->createMock (MessageOptionsInterface::class)));
201
203
}
0 commit comments