From 3118c9088a8e36c248e227ca6099525c529cd0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= Date: Sat, 17 Apr 2021 16:28:48 +0100 Subject: [PATCH] Make sure we will not forget to add notifier transport factories to FrameworkExtension anymore --- .../Fixtures/php/notifier.php | 4 ++- .../Fixtures/yml/notifier.yml | 3 +- .../FrameworkExtensionTest.php | 11 ++++++ .../Bundle/FrameworkBundle/composer.json | 35 ++++++++++++++++++- 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php index 277c786904..5ffe142be4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php @@ -4,7 +4,9 @@ use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\BarMessage; use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\FooMessage; $container->loadFromExtension('framework', [ - 'messenger' => null, + 'messenger' => [ + 'enabled' => true + ], 'mailer' => [ 'dsn' => 'smtp://example.com', ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml index b77b547356..586cb98a4a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml @@ -1,5 +1,6 @@ framework: - messenger: ~ + messenger: + enabled: true mailer: dsn: 'smtp://example.com' notifier: diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index b8a43474b1..02f8748c3d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -45,6 +45,7 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Finder\Finder; use Symfony\Component\Form\Form; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\RetryableHttpClient; @@ -1873,6 +1874,16 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertFalse($container->hasDefinition('texter')); } + public function testIfNotifierTransportsAreKnownByFrameworkExtension() + { + $container = $this->createContainerFromFile('notifier'); + + foreach ((new Finder())->in(\dirname(__DIR__, 4).'/Component/Notifier/Bridge')->directories()->depth(0)->exclude('Mercure') as $bridgeDirectory) { + $transportFactoryName = strtolower($bridgeDirectory->getFilename()); + $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())); + } + } + protected function createContainer(array $data = []) { return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([ diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 60b72af6d5..e2032b0fc6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -51,6 +51,38 @@ "symfony/messenger": "^5.2", "symfony/mime": "^4.4|^5.0", "symfony/notifier": "^5.3", + "symfony/allmysms-notifier": "^5.3", + "symfony/clickatell-notifier": "^5.3", + "symfony/discord-notifier": "^5.3", + "symfony/esendex-notifier": "^5.3", + "symfony/fake-chat-notifier": "^5.3", + "symfony/fake-sms-notifier": "^5.3", + "symfony/firebase-notifier": "^5.3", + "symfony/free-mobile-notifier": "^5.3", + "symfony/gatewayapi-notifier": "^5.3", + "symfony/gitter-notifier": "^5.3", + "symfony/google-chat-notifier": "^5.3", + "symfony/infobip-notifier": "^5.3", + "symfony/iqsms-notifier": "^5.3", + "symfony/light-sms-notifier": "^5.3", + "symfony/linked-in-notifier": "^5.3", + "symfony/mattermost-notifier": "^5.3", + "symfony/message-bird-notifier": "^5.3", + "symfony/microsoft-teams-notifier": "^5.3", + "symfony/mobyt-notifier": "^5.3", + "symfony/nexmo-notifier": "^5.3", + "symfony/octopush-notifier": "^5.3", + "symfony/ovh-cloud-notifier": "^5.3", + "symfony/rocket-chat-notifier": "^5.3", + "symfony/sendinblue-notifier": "^5.3", + "symfony/sinch-notifier": "^5.3", + "symfony/slack-notifier": "^5.3", + "symfony/smsapi-notifier": "^5.3", + "symfony/sms-biuras-notifier": "^5.3", + "symfony/spot-hit-notifier": "^5.3", + "symfony/telegram-notifier": "^5.3", + "symfony/twilio-notifier": "^5.3", + "symfony/zulip-notifier": "^5.3", "symfony/process": "^4.4|^5.0", "symfony/rate-limiter": "^5.2", "symfony/security-bundle": "^5.3", @@ -66,7 +98,8 @@ "symfony/web-link": "^4.4|^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "paragonie/sodium_compat": "^1.8", - "twig/twig": "^2.10|^3.0" + "twig/twig": "^2.10|^3.0", + "symfony/phpunit-bridge": "^5.3" }, "conflict": { "doctrine/persistence": "<1.3",