Skip to content

Commit 2317b7d

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Cache] fix trying to load Memcached before checking we can [Notifier] Make `TransportTestCase` data providers static [Notifier] Add missing use statement
2 parents f56e12e + 29a5708 commit 2317b7d

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

Tests/SmsapiTransportTest.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,35 @@
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;
24+
use Symfony\Component\Notifier\Transport\TransportInterface;
2225
use Symfony\Contracts\HttpClient\HttpClientInterface;
2326

2427
final class SmsapiTransportTest extends TransportTestCase
2528
{
26-
public function createTransport(HttpClientInterface $client = null, bool $fast = false, bool $test = false): SmsapiTransport
29+
public static function createTransport(HttpClientInterface $client = null, bool $fast = false, bool $test = false): SmsapiTransport
2730
{
28-
return (new SmsapiTransport('testToken', 'testFrom', $client ?? $this->createMock(HttpClientInterface::class)))->setHost('test.host')->setFast($fast)->setTest($test);
31+
return (new SmsapiTransport('testToken', 'testFrom', $client ?? new DummyHttpClient()))->setHost('test.host')->setFast($fast)->setTest($test);
2932
}
3033

31-
public function toStringProvider(): iterable
34+
public static function toStringProvider(): iterable
3235
{
33-
yield ['smsapi://test.host?from=testFrom', $this->createTransport()];
34-
yield ['smsapi://test.host?from=testFrom&fast=1', $this->createTransport(null, true)];
35-
yield ['smsapi://test.host?from=testFrom&test=1', $this->createTransport(null, false, true)];
36-
yield ['smsapi://test.host?from=testFrom&fast=1&test=1', $this->createTransport(null, true, true)];
36+
yield ['smsapi://test.host?from=testFrom', self::createTransport()];
37+
yield ['smsapi://test.host?from=testFrom&fast=1', self::createTransport(null, true)];
38+
yield ['smsapi://test.host?from=testFrom&test=1', self::createTransport(null, false, true)];
39+
yield ['smsapi://test.host?from=testFrom&fast=1&test=1', self::createTransport(null, true, true)];
3740
}
3841

39-
public function supportedMessagesProvider(): iterable
42+
public static function supportedMessagesProvider(): iterable
4043
{
4144
yield [new SmsMessage('0611223344', 'Hello!')];
4245
}
4346

44-
public function unsupportedMessagesProvider(): iterable
47+
public static function unsupportedMessagesProvider(): iterable
4548
{
4649
yield [new ChatMessage('Hello!')];
47-
yield [$this->createMock(MessageInterface::class)];
50+
yield [new DummyMessage()];
4851
}
4952

5053
public function createClient(int $statusCode, string $content): HttpClientInterface
@@ -74,7 +77,7 @@ public function responseProvider(): iterable
7477
public function testThrowExceptionWhenMessageWasNotSent(int $statusCode, string $content, string $errorMessage)
7578
{
7679
$client = $this->createClient($statusCode, $content);
77-
$transport = $this->createTransport($client);
80+
$transport = self::createTransport($client);
7881
$message = new SmsMessage('0611223344', 'Hello!');
7982

8083
$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": ">=8.1",
2020
"symfony/http-client": "^5.4|^6.0",
21-
"symfony/notifier": "^6.2"
21+
"symfony/notifier": "^6.2.7"
2222
},
2323
"autoload": {
2424
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Smsapi\\": "" },

0 commit comments

Comments
 (0)