Make sure we will not forget to add notifier transport factories to FrameworkExtension anymore

This commit is contained in:
Jan Schädlich 2021-04-17 16:28:48 +01:00 committed by Fabien Potencier
parent 3fd41ce110
commit 3118c9088a
4 changed files with 50 additions and 3 deletions

View File

@ -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',
],

View File

@ -1,5 +1,6 @@
framework:
messenger: ~
messenger:
enabled: true
mailer:
dsn: 'smtp://example.com'
notifier:

View File

@ -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([

View File

@ -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",