Skip to content

Commit 10482d6

Browse files
committed
minor #40845 [Notifier] Notifier add test for adding transport factories to framework extension (jschaedl, fabpot)
This PR was merged into the 5.3-dev branch. Discussion ---------- [Notifier] Notifier add test for adding transport factories to framework extension | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> Follow up of symfony/symfony#40843 and symfony/symfony#40844 Needs to be rebased after both were merged. See changes: symfony/symfony@ddf61c2 Commits ------- 3118c9088a Make sure we will not forget to add notifier transport factories to FrameworkExtension anymore
2 parents 3de1b65 + aeef2c0 commit 10482d6

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

Tests/DependencyInjection/Fixtures/php/notifier.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage;
55

66
$container->loadFromExtension('framework', [
7-
'messenger' => null,
7+
'messenger' => [
8+
'enabled' => true
9+
],
810
'mailer' => [
911
'dsn' => 'smtp://example.com',
1012
],

Tests/DependencyInjection/Fixtures/yml/notifier.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
framework:
2-
messenger: ~
2+
messenger:
3+
enabled: true
34
mailer:
45
dsn: 'smtp://example.com'
56
notifier:

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
4646
use Symfony\Component\DependencyInjection\Reference;
4747
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
48+
use Symfony\Component\Finder\Finder;
4849
use Symfony\Component\Form\Form;
4950
use Symfony\Component\HttpClient\MockHttpClient;
5051
use Symfony\Component\HttpClient\RetryableHttpClient;
@@ -1873,6 +1874,16 @@ public function testNotifierWithoutTransports()
18731874
$this->assertFalse($container->hasDefinition('texter'));
18741875
}
18751876

1877+
public function testIfNotifierTransportsAreKnownByFrameworkExtension()
1878+
{
1879+
$container = $this->createContainerFromFile('notifier');
1880+
1881+
foreach ((new Finder())->in(\dirname(__DIR__, 4).'/Component/Notifier/Bridge')->directories()->depth(0)->exclude('Mercure') as $bridgeDirectory) {
1882+
$transportFactoryName = strtolower($bridgeDirectory->getFilename());
1883+
$this->assertTrue($container->hasDefinition('notifier.transport_factory.'.$transportFactoryName), sprintf('Did you forget to add the TransportFactory: "%s" to the $classToServices array in the FrameworkBundleExtension?', $bridgeDirectory->getFilename()));
1884+
}
1885+
}
1886+
18761887
protected function createContainer(array $data = [])
18771888
{
18781889
return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([

composer.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,38 @@
5151
"symfony/messenger": "^5.2",
5252
"symfony/mime": "^4.4|^5.0",
5353
"symfony/notifier": "^5.3",
54+
"symfony/allmysms-notifier": "^5.3",
55+
"symfony/clickatell-notifier": "^5.3",
56+
"symfony/discord-notifier": "^5.3",
57+
"symfony/esendex-notifier": "^5.3",
58+
"symfony/fake-chat-notifier": "^5.3",
59+
"symfony/fake-sms-notifier": "^5.3",
60+
"symfony/firebase-notifier": "^5.3",
61+
"symfony/free-mobile-notifier": "^5.3",
62+
"symfony/gatewayapi-notifier": "^5.3",
63+
"symfony/gitter-notifier": "^5.3",
64+
"symfony/google-chat-notifier": "^5.3",
65+
"symfony/infobip-notifier": "^5.3",
66+
"symfony/iqsms-notifier": "^5.3",
67+
"symfony/light-sms-notifier": "^5.3",
68+
"symfony/linked-in-notifier": "^5.3",
69+
"symfony/mattermost-notifier": "^5.3",
70+
"symfony/message-bird-notifier": "^5.3",
71+
"symfony/microsoft-teams-notifier": "^5.3",
72+
"symfony/mobyt-notifier": "^5.3",
73+
"symfony/nexmo-notifier": "^5.3",
74+
"symfony/octopush-notifier": "^5.3",
75+
"symfony/ovh-cloud-notifier": "^5.3",
76+
"symfony/rocket-chat-notifier": "^5.3",
77+
"symfony/sendinblue-notifier": "^5.3",
78+
"symfony/sinch-notifier": "^5.3",
79+
"symfony/slack-notifier": "^5.3",
80+
"symfony/smsapi-notifier": "^5.3",
81+
"symfony/sms-biuras-notifier": "^5.3",
82+
"symfony/spot-hit-notifier": "^5.3",
83+
"symfony/telegram-notifier": "^5.3",
84+
"symfony/twilio-notifier": "^5.3",
85+
"symfony/zulip-notifier": "^5.3",
5486
"symfony/process": "^4.4|^5.0",
5587
"symfony/rate-limiter": "^5.2",
5688
"symfony/security-bundle": "^5.3",
@@ -66,7 +98,8 @@
6698
"symfony/web-link": "^4.4|^5.0",
6799
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
68100
"paragonie/sodium_compat": "^1.8",
69-
"twig/twig": "^2.10|^3.0"
101+
"twig/twig": "^2.10|^3.0",
102+
"symfony/phpunit-bridge": "^5.3"
70103
},
71104
"conflict": {
72105
"doctrine/persistence": "<1.3",

0 commit comments

Comments
 (0)