Skip to content

Commit 29a5708

Browse files
[Notifier] Make TransportTestCase data providers static
1 parent 3a469ab commit 29a5708

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Tests/SmsapiTransportTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use Symfony\Component\Notifier\Message\MessageInterface;
2020
use Symfony\Component\Notifier\Message\SmsMessage;
2121
use Symfony\Component\Notifier\Test\TransportTestCase;
22+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
23+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
2224
use Symfony\Component\Notifier\Transport\TransportInterface;
2325
use 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);

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\\Smsapi\\": "" },

0 commit comments

Comments
 (0)