Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2f6d7fc

Browse filesBrowse files
[Notifier] Make TransportTestCase data providers static
1 parent c09405b commit 2f6d7fc
Copy full SHA for 2f6d7fc

File tree

113 files changed

+863
-536
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

113 files changed

+863
-536
lines changed

‎src/Symfony/Component/Notifier/Bridge/AllMySms/Tests/AllMySmsTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/AllMySms/Tests/AllMySmsTransportTest.php
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,34 @@
1313

1414
use Symfony\Component\Notifier\Bridge\AllMySms\AllMySmsTransport;
1515
use Symfony\Component\Notifier\Message\ChatMessage;
16-
use Symfony\Component\Notifier\Message\MessageInterface;
1716
use Symfony\Component\Notifier\Message\SmsMessage;
1817
use Symfony\Component\Notifier\Test\TransportTestCase;
18+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
19+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
20+
use Symfony\Component\Notifier\Transport\TransportInterface;
1921
use Symfony\Contracts\HttpClient\HttpClientInterface;
2022

2123
final class AllMySmsTransportTest extends TransportTestCase
2224
{
23-
public function createTransport(HttpClientInterface $client = null, string $from = null): AllMySmsTransport
25+
public static function createTransport(HttpClientInterface $client = null, string $from = null): AllMySmsTransport
2426
{
25-
return new AllMySmsTransport('login', 'apiKey', $from, $client ?? $this->createMock(HttpClientInterface::class));
27+
return new AllMySmsTransport('login', 'apiKey', $from, $client ?? new DummyHttpClient());
2628
}
2729

28-
public function toStringProvider(): iterable
30+
public static function toStringProvider(): iterable
2931
{
30-
yield ['allmysms://api.allmysms.com', $this->createTransport()];
31-
yield ['allmysms://api.allmysms.com?from=TEST', $this->createTransport(null, 'TEST')];
32+
yield ['allmysms://api.allmysms.com', self::createTransport()];
33+
yield ['allmysms://api.allmysms.com?from=TEST', self::createTransport(null, 'TEST')];
3234
}
3335

34-
public function supportedMessagesProvider(): iterable
36+
public static function supportedMessagesProvider(): iterable
3537
{
3638
yield [new SmsMessage('0611223344', 'Hello!')];
3739
}
3840

39-
public function unsupportedMessagesProvider(): iterable
41+
public static function unsupportedMessagesProvider(): iterable
4042
{
4143
yield [new ChatMessage('Hello!')];
42-
yield [$this->createMock(MessageInterface::class)];
44+
yield [new DummyMessage()];
4345
}
4446
}

‎src/Symfony/Component/Notifier/Bridge/AllMySms/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/AllMySms/composer.json
+1-1Lines 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\\AllMySms\\": "" },

‎src/Symfony/Component/Notifier/Bridge/AmazonSns/Tests/AmazonSnsTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/AmazonSns/Tests/AmazonSnsTransportTest.php
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,36 @@
1717
use Symfony\Component\Notifier\Bridge\AmazonSns\AmazonSnsTransport;
1818
use Symfony\Component\Notifier\Exception\InvalidArgumentException;
1919
use Symfony\Component\Notifier\Message\ChatMessage;
20-
use Symfony\Component\Notifier\Message\MessageInterface;
21-
use Symfony\Component\Notifier\Message\MessageOptionsInterface;
2220
use Symfony\Component\Notifier\Message\SmsMessage;
2321
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\Tests\Fixtures\TestOptions;
25+
use Symfony\Component\Notifier\Transport\TransportInterface;
2426
use Symfony\Contracts\HttpClient\HttpClientInterface;
2527

2628
class AmazonSnsTransportTest extends TransportTestCase
2729
{
28-
public function createTransport(HttpClientInterface $client = null): AmazonSnsTransport
30+
public static function createTransport(HttpClientInterface $client = null): AmazonSnsTransport
2931
{
30-
return (new AmazonSnsTransport(new SnsClient(['region' => 'eu-west-3']), $client ?? $this->createMock(HttpClientInterface::class)))->setHost('host.test');
32+
return (new AmazonSnsTransport(new SnsClient(['region' => 'eu-west-3']), $client ?? new DummyHttpClient()))->setHost('host.test');
3133
}
3234

33-
public function toStringProvider(): iterable
35+
public static function toStringProvider(): iterable
3436
{
35-
yield ['sns://host.test?region=eu-west-3', $this->createTransport()];
37+
yield ['sns://host.test?region=eu-west-3', self::createTransport()];
3638
}
3739

38-
public function supportedMessagesProvider(): iterable
40+
public static function supportedMessagesProvider(): iterable
3941
{
4042
yield [new SmsMessage('0601020304', 'Hello!')];
4143
yield [new ChatMessage('Hello', new AmazonSnsOptions('my-topic'))];
4244
}
4345

44-
public function unsupportedMessagesProvider(): iterable
46+
public static function unsupportedMessagesProvider(): iterable
4547
{
46-
yield [$this->createMock(MessageInterface::class)];
47-
yield [new ChatMessage('hello', $this->createMock(MessageOptionsInterface::class))];
48+
yield [new DummyMessage()];
49+
yield [new ChatMessage('hello', new TestOptions())];
4850
}
4951

5052
public function testSmsMessageWithFrom()

‎src/Symfony/Component/Notifier/Bridge/AmazonSns/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/AmazonSns/composer.json
+1-1Lines 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
"async-aws/sns": "^1.0"
2323
},
2424
"autoload": {

‎src/Symfony/Component/Notifier/Bridge/Chatwork/Tests/ChatworkTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Chatwork/Tests/ChatworkTransportTest.php
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,33 @@
1818
use Symfony\Component\Notifier\Message\MessageInterface;
1919
use Symfony\Component\Notifier\Message\SmsMessage;
2020
use Symfony\Component\Notifier\Test\TransportTestCase;
21+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
22+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
2123
use Symfony\Component\Notifier\Transport\TransportInterface;
2224
use Symfony\Contracts\HttpClient\HttpClientInterface;
2325
use Symfony\Contracts\HttpClient\ResponseInterface;
2426

2527
class ChatworkTransportTest extends TransportTestCase
2628
{
27-
public function createTransport(HttpClientInterface $client = null): TransportInterface
29+
public static function createTransport(HttpClientInterface $client = null): TransportInterface
2830
{
29-
return (new ChatworkTransport('testToken', 'testRoomId', $client ?? $this->createMock(HttpClientInterface::class)))->setHost('host.test');
31+
return (new ChatworkTransport('testToken', 'testRoomId', $client ?? new DummyHttpClient()))->setHost('host.test');
3032
}
3133

32-
public function toStringProvider(): iterable
34+
public static function toStringProvider(): iterable
3335
{
34-
yield ['chatwork://host.test?room_id=testRoomId', $this->createTransport()];
36+
yield ['chatwork://host.test?room_id=testRoomId', self::createTransport()];
3537
}
3638

37-
public function supportedMessagesProvider(): iterable
39+
public static function supportedMessagesProvider(): iterable
3840
{
3941
yield [new ChatMessage('Hello!')];
4042
}
4143

42-
public function unsupportedMessagesProvider(): iterable
44+
public static function unsupportedMessagesProvider(): iterable
4345
{
4446
yield [new SmsMessage('0611223344', 'Hello!')];
45-
yield [$this->createMock(MessageInterface::class)];
47+
yield [new DummyMessage()];
4648
}
4749

4850
public function testWithErrorResponseThrows()

‎src/Symfony/Component/Notifier/Bridge/Chatwork/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Chatwork/composer.json
+1-1Lines 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\\Chatwork\\": "" },

‎src/Symfony/Component/Notifier/Bridge/Clickatell/Tests/ClickatellTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Clickatell/Tests/ClickatellTransportTest.php
+13-10Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,39 @@
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
use Symfony\Contracts\HttpClient\ResponseInterface;
2427

2528
final class ClickatellTransportTest extends TransportTestCase
2629
{
27-
public function createTransport(HttpClientInterface $client = null, string $from = null): ClickatellTransport
30+
public static function createTransport(HttpClientInterface $client = null, string $from = null): ClickatellTransport
2831
{
29-
return new ClickatellTransport('authToken', $from, $client ?? $this->createMock(HttpClientInterface::class));
32+
return new ClickatellTransport('authToken', $from, $client ?? new DummyHttpClient());
3033
}
3134

32-
public function toStringProvider(): iterable
35+
public static function toStringProvider(): iterable
3336
{
34-
yield ['clickatell://api.clickatell.com', $this->createTransport()];
35-
yield ['clickatell://api.clickatell.com?from=TEST', $this->createTransport(null, 'TEST')];
37+
yield ['clickatell://api.clickatell.com', self::createTransport()];
38+
yield ['clickatell://api.clickatell.com?from=TEST', self::createTransport(null, 'TEST')];
3639
}
3740

38-
public function supportedMessagesProvider(): iterable
41+
public static function supportedMessagesProvider(): iterable
3942
{
4043
yield [new SmsMessage('+33612345678', 'Hello!')];
4144
}
4245

43-
public function unsupportedMessagesProvider(): iterable
46+
public static function unsupportedMessagesProvider(): iterable
4447
{
4548
yield [new ChatMessage('Hello!')];
46-
yield [$this->createMock(MessageInterface::class)];
49+
yield [new DummyMessage()];
4750
}
4851

4952
public function testExceptionIsThrownWhenNonMessageIsSend()
5053
{
51-
$transport = $this->createTransport();
54+
$transport = self::createTransport();
5255

5356
$this->expectException(LogicException::class);
5457

@@ -73,7 +76,7 @@ public function testExceptionIsThrownWhenHttpSendFailed()
7376

7477
$client = new MockHttpClient($response);
7578

76-
$transport = $this->createTransport($client);
79+
$transport = self::createTransport($client);
7780

7881
$this->expectException(TransportException::class);
7982
$this->expectExceptionMessage('Unable to send SMS with Clickatell: Error code 105 with message "Invalid Account Reference EX0000000" (https://documentation-page).');

‎src/Symfony/Component/Notifier/Bridge/Clickatell/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Clickatell/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require": {
2323
"php": ">=8.1",
2424
"symfony/http-client": "^5.4|^6.0",
25-
"symfony/notifier": "^6.2"
25+
"symfony/notifier": "^6.2.7"
2626
},
2727
"autoload": {
2828
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\Clickatell\\": "" },

‎src/Symfony/Component/Notifier/Bridge/ContactEveryone/Tests/ContactEveryoneTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/ContactEveryone/Tests/ContactEveryoneTransportTest.php
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,33 @@
1818
use Symfony\Component\Notifier\Message\MessageInterface;
1919
use Symfony\Component\Notifier\Message\SmsMessage;
2020
use Symfony\Component\Notifier\Test\TransportTestCase;
21+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
22+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
2123
use Symfony\Component\Uid\Uuid;
2224
use Symfony\Contracts\HttpClient\HttpClientInterface;
2325
use Symfony\Contracts\HttpClient\ResponseInterface;
2426

2527
final class ContactEveryoneTransportTest extends TransportTestCase
2628
{
27-
public function createTransport(HttpClientInterface $client = null): ContactEveryoneTransport
29+
public static function createTransport(HttpClientInterface $client = null): ContactEveryoneTransport
2830
{
29-
return new ContactEveryoneTransport('API_TOKEN', 'Symfony', 'Foo', $client ?? $this->createMock(HttpClientInterface::class));
31+
return new ContactEveryoneTransport('API_TOKEN', 'Symfony', 'Foo', $client ?? new DummyHttpClient());
3032
}
3133

32-
public function toStringProvider(): iterable
34+
public static function toStringProvider(): iterable
3335
{
34-
yield ['contact-everyone://contact-everyone.orange-business.com?diffusionname=Symfony&category=Foo', $this->createTransport()];
36+
yield ['contact-everyone://contact-everyone.orange-business.com?diffusionname=Symfony&category=Foo', self::createTransport()];
3537
}
3638

37-
public function supportedMessagesProvider(): iterable
39+
public static function supportedMessagesProvider(): iterable
3840
{
3941
yield [new SmsMessage('0611223344', 'Hello!')];
4042
}
4143

42-
public function unsupportedMessagesProvider(): iterable
44+
public static function unsupportedMessagesProvider(): iterable
4345
{
4446
yield [new ChatMessage('Hello!')];
45-
yield [$this->createMock(MessageInterface::class)];
47+
yield [new DummyMessage()];
4648
}
4749

4850
public function testSendSuccessfully()

‎src/Symfony/Component/Notifier/Bridge/ContactEveryone/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/ContactEveryone/composer.json
+1-1Lines 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
"require-dev": {
2424
"symfony/uid": "^5.4|^6.0"

‎src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,40 @@
1616
use Symfony\Component\Notifier\Exception\LengthException;
1717
use Symfony\Component\Notifier\Exception\TransportException;
1818
use Symfony\Component\Notifier\Message\ChatMessage;
19-
use Symfony\Component\Notifier\Message\MessageInterface;
2019
use Symfony\Component\Notifier\Message\SmsMessage;
2120
use Symfony\Component\Notifier\Test\TransportTestCase;
21+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
22+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
23+
use Symfony\Component\Notifier\Transport\TransportInterface;
2224
use Symfony\Contracts\HttpClient\HttpClientInterface;
2325
use Symfony\Contracts\HttpClient\ResponseInterface;
2426

2527
final class DiscordTransportTest extends TransportTestCase
2628
{
27-
public function createTransport(HttpClientInterface $client = null): DiscordTransport
29+
public static function createTransport(HttpClientInterface $client = null): DiscordTransport
2830
{
29-
return (new DiscordTransport('testToken', 'testWebhookId', $client ?? $this->createMock(HttpClientInterface::class)))->setHost('host.test');
31+
return (new DiscordTransport('testToken', 'testWebhookId', $client ?? new DummyHttpClient()))->setHost('host.test');
3032
}
3133

32-
public function toStringProvider(): iterable
34+
public static function toStringProvider(): iterable
3335
{
34-
yield ['discord://host.test?webhook_id=testWebhookId', $this->createTransport()];
36+
yield ['discord://host.test?webhook_id=testWebhookId', self::createTransport()];
3537
}
3638

37-
public function supportedMessagesProvider(): iterable
39+
public static function supportedMessagesProvider(): iterable
3840
{
3941
yield [new ChatMessage('Hello!')];
4042
}
4143

42-
public function unsupportedMessagesProvider(): iterable
44+
public static function unsupportedMessagesProvider(): iterable
4345
{
4446
yield [new SmsMessage('0611223344', 'Hello!')];
45-
yield [$this->createMock(MessageInterface::class)];
47+
yield [new DummyMessage()];
4648
}
4749

4850
public function testSendChatMessageWithMoreThan2000CharsThrowsLogicException()
4951
{
50-
$transport = $this->createTransport();
52+
$transport = self::createTransport();
5153

5254
$this->expectException(LengthException::class);
5355
$this->expectExceptionMessage('The subject length of a Discord message must not exceed 2000 characters.');
@@ -69,7 +71,7 @@ public function testSendWithErrorResponseThrows()
6971
return $response;
7072
});
7173

72-
$transport = $this->createTransport($client);
74+
$transport = self::createTransport($client);
7375

7476
$this->expectException(TransportException::class);
7577
$this->expectExceptionMessageMatches('/testDescription.+testErrorCode/');

‎src/Symfony/Component/Notifier/Bridge/Discord/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Discord/composer.json
+1-1Lines 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
"symfony/polyfill-mbstring": "^1.0"
2323
},
2424
"autoload": {

‎src/Symfony/Component/Notifier/Bridge/Engagespot/Tests/EngagespotTransportTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Engagespot/Tests/EngagespotTransportTest.php
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,33 @@
1616
use Symfony\Component\Notifier\Message\PushMessage;
1717
use Symfony\Component\Notifier\Message\SmsMessage;
1818
use Symfony\Component\Notifier\Test\TransportTestCase;
19+
use Symfony\Component\Notifier\Tests\Fixtures\DummyHttpClient;
20+
use Symfony\Component\Notifier\Tests\Fixtures\DummyMessage;
1921
use Symfony\Contracts\HttpClient\HttpClientInterface;
2022

2123
/**
2224
* @author Daniel GORGAN <https://github.com/danut007ro>
2325
*/
2426
final class EngagespotTransportTest extends TransportTestCase
2527
{
26-
public function createTransport(HttpClientInterface $client = null): EngagespotTransport
28+
public static function createTransport(HttpClientInterface $client = null): EngagespotTransport
2729
{
28-
return new EngagespotTransport('apiKey', 'TEST', $client ?? $this->createMock(HttpClientInterface::class));
30+
return new EngagespotTransport('apiKey', 'TEST', $client ?? new DummyHttpClient());
2931
}
3032

31-
public function toStringProvider(): iterable
33+
public static function toStringProvider(): iterable
3234
{
33-
yield ['engagespot://api.engagespot.co/2/campaigns?campaign_name=TEST', $this->createTransport()];
35+
yield ['engagespot://api.engagespot.co/2/campaigns?campaign_name=TEST', self::createTransport()];
3436
}
3537

36-
public function supportedMessagesProvider(): iterable
38+
public static function supportedMessagesProvider(): iterable
3739
{
3840
yield [new PushMessage('Hello!', 'Symfony Notifier')];
3941
}
4042

41-
public function unsupportedMessagesProvider(): iterable
43+
public static function unsupportedMessagesProvider(): iterable
4244
{
4345
yield [new SmsMessage('0123456789', 'Hello!')];
44-
yield [$this->createMock(MessageInterface::class)];
46+
yield [new DummyMessage()];
4547
}
4648
}

‎src/Symfony/Component/Notifier/Bridge/Engagespot/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Engagespot/composer.json
+1-1Lines 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\\Engagespot\\": "" },

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.