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 ;
26
+ use Symfony \Component \Notifier \Transport \TransportInterface ;
24
27
use Symfony \Contracts \HttpClient \HttpClientInterface ;
25
28
use Symfony \Contracts \HttpClient \ResponseInterface ;
26
29
27
30
final class LinkedInTransportTest extends TransportTestCase
28
31
{
29
- public function createTransport (HttpClientInterface $ client = null ): LinkedInTransport
32
+ public static function createTransport (HttpClientInterface $ client = null ): LinkedInTransport
30
33
{
31
- return (new LinkedInTransport ('AuthToken ' , 'AccountId ' , $ client ?? $ this -> createMock (HttpClientInterface::class )))->setHost ('host.test ' );
34
+ return (new LinkedInTransport ('AuthToken ' , 'AccountId ' , $ client ?? new DummyHttpClient ( )))->setHost ('host.test ' );
32
35
}
33
36
34
- public function toStringProvider (): iterable
37
+ public static function toStringProvider (): iterable
35
38
{
36
- yield ['linkedin://host.test ' , $ this -> createTransport ()];
39
+ yield ['linkedin://host.test ' , self :: createTransport ()];
37
40
}
38
41
39
- public function supportedMessagesProvider (): iterable
42
+ public static function supportedMessagesProvider (): iterable
40
43
{
41
44
yield [new ChatMessage ('Hello! ' )];
42
45
}
43
46
44
- public function unsupportedMessagesProvider (): iterable
47
+ public static function unsupportedMessagesProvider (): iterable
45
48
{
46
49
yield [new SmsMessage ('0611223344 ' , 'Hello! ' )];
47
- yield [$ this -> createMock (MessageInterface::class )];
50
+ yield [new DummyMessage ( )];
48
51
}
49
52
50
53
public function testSendWithEmptyArrayResponseThrowsTransportException ()
@@ -61,7 +64,7 @@ public function testSendWithEmptyArrayResponseThrowsTransportException()
61
64
return $ response ;
62
65
});
63
66
64
- $ transport = $ this -> createTransport ($ client );
67
+ $ transport = self :: createTransport ($ client );
65
68
66
69
$ this ->expectException (TransportException::class);
67
70
@@ -86,7 +89,7 @@ public function testSendWithErrorResponseThrowsTransportException()
86
89
return $ response ;
87
90
});
88
91
89
- $ transport = $ this -> createTransport ($ client );
92
+ $ transport = self :: createTransport ($ client );
90
93
91
94
$ transport ->send (new ChatMessage ('testMessage ' ));
92
95
}
@@ -130,7 +133,7 @@ public function testSendWithOptions()
130
133
131
134
return $ response ;
132
135
});
133
- $ transport = $ this -> createTransport ($ client );
136
+ $ transport = self :: createTransport ($ client );
134
137
135
138
$ transport ->send (new ChatMessage ($ message ));
136
139
}
@@ -178,7 +181,7 @@ public function testSendWithNotification()
178
181
return $ response ;
179
182
});
180
183
181
- $ transport = $ this -> createTransport ($ client );
184
+ $ transport = self :: createTransport ($ client );
182
185
183
186
$ transport ->send ($ chatMessage );
184
187
}
@@ -191,7 +194,7 @@ public function testSendWithInvalidOptions()
191
194
return $ this ->createMock (ResponseInterface::class);
192
195
});
193
196
194
- $ transport = $ this -> createTransport ($ client );
197
+ $ transport = self :: createTransport ($ client );
195
198
196
199
$ transport ->send (new ChatMessage ('testMessage ' , $ this ->createMock (MessageOptionsInterface::class)));
197
200
}
0 commit comments