Skip to content

Commit 3e6a2fa

Browse files
[Notifier] Make TransportTestCase data providers static
1 parent 15fe1db commit 3e6a2fa

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

Tests/LinkedInTransportTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use Symfony\Component\Notifier\Message\SmsMessage;
2222
use Symfony\Component\Notifier\Notification\Notification;
2323
use Symfony\Component\Notifier\Test\TransportTestCase;
24+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
25+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
2426
use Symfony\Component\Notifier\Transport\TransportInterface;
2527
use Symfony\Contracts\HttpClient\HttpClientInterface;
2628
use Symfony\Contracts\HttpClient\ResponseInterface;
@@ -30,25 +32,25 @@ final class LinkedInTransportTest extends TransportTestCase
3032
/**
3133
* @return LinkedInTransport
3234
*/
33-
public function createTransport(HttpClientInterface $client = null): TransportInterface
35+
public static function createTransport(HttpClientInterface $client = null): TransportInterface
3436
{
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');
3638
}
3739

38-
public function toStringProvider(): iterable
40+
public static function toStringProvider(): iterable
3941
{
40-
yield ['linkedin://host.test', $this->createTransport()];
42+
yield ['linkedin://host.test', self::createTransport()];
4143
}
4244

43-
public function supportedMessagesProvider(): iterable
45+
public static function supportedMessagesProvider(): iterable
4446
{
4547
yield [new ChatMessage('Hello!')];
4648
}
4749

48-
public function unsupportedMessagesProvider(): iterable
50+
public static function unsupportedMessagesProvider(): iterable
4951
{
5052
yield [new SmsMessage('0611223344', 'Hello!')];
51-
yield [$this->createMock(MessageInterface::class)];
53+
yield [new DummyMessage()];
5254
}
5355

5456
public function testSendWithEmptyArrayResponseThrowsTransportException()
@@ -65,7 +67,7 @@ public function testSendWithEmptyArrayResponseThrowsTransportException()
6567
return $response;
6668
});
6769

68-
$transport = $this->createTransport($client);
70+
$transport = self::createTransport($client);
6971

7072
$this->expectException(TransportException::class);
7173

@@ -90,7 +92,7 @@ public function testSendWithErrorResponseThrowsTransportException()
9092
return $response;
9193
});
9294

93-
$transport = $this->createTransport($client);
95+
$transport = self::createTransport($client);
9496

9597
$transport->send(new ChatMessage('testMessage'));
9698
}
@@ -134,7 +136,7 @@ public function testSendWithOptions()
134136

135137
return $response;
136138
});
137-
$transport = $this->createTransport($client);
139+
$transport = self::createTransport($client);
138140

139141
$transport->send(new ChatMessage($message));
140142
}
@@ -182,7 +184,7 @@ public function testSendWithNotification()
182184
return $response;
183185
});
184186

185-
$transport = $this->createTransport($client);
187+
$transport = self::createTransport($client);
186188

187189
$transport->send($chatMessage);
188190
}
@@ -195,7 +197,7 @@ public function testSendWithInvalidOptions()
195197
return $this->createMock(ResponseInterface::class);
196198
});
197199

198-
$transport = $this->createTransport($client);
200+
$transport = self::createTransport($client);
199201

200202
$transport->send(new ChatMessage('testMessage', $this->createMock(MessageOptionsInterface::class)));
201203
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=7.2.5",
2020
"symfony/http-client": "^4.3|^5.0|^6.0",
21-
"symfony/notifier": "^5.3|^6.0"
21+
"symfony/notifier": "^5.4.21|^6.2.7"
2222
},
2323
"autoload": {
2424
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\LinkedIn\\": "" },

0 commit comments

Comments
 (0)