diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 2d33aae50fe25..44ba965b79d88 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -36,6 +36,7 @@ + @@ -627,6 +628,7 @@ + @@ -727,4 +729,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php new file mode 100644 index 0000000000000..277c7869043fd --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier.php @@ -0,0 +1,28 @@ +loadFromExtension('framework', [ + 'messenger' => null, + 'mailer' => [ + 'dsn' => 'smtp://example.com', + ], + 'notifier' => [ + 'enabled' => true, + 'notification_on_failed_messages' => true, + 'chatter_transports' => [ + 'slack' => 'null' + ], + 'texter_transports' => [ + 'twilio' => 'null' + ], + 'channel_policy' => [ + 'low' => ['slack'], + 'high' => ['slack', 'twilio'], + ], + 'admin_recipients' => [ + ['email' => 'test@test.de', 'phone' => '+490815',], + ] + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_mailer.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_mailer.php new file mode 100644 index 0000000000000..6d51ef98517f4 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_mailer.php @@ -0,0 +1,30 @@ +loadFromExtension('framework', [ + 'mailer' => [ + 'enabled' => false, + ], + 'messenger' => [ + 'enabled' => true, + ], + 'notifier' => [ + 'enabled' => true, + 'notification_on_failed_messages' => true, + 'chatter_transports' => [ + 'slack' => 'null' + ], + 'texter_transports' => [ + 'twilio' => 'null' + ], + 'channel_policy' => [ + 'low' => ['slack'], + 'high' => ['slack', 'twilio'], + ], + 'admin_recipients' => [ + ['email' => 'test@test.de', 'phone' => '+490815',], + ] + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_messenger.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_messenger.php new file mode 100644 index 0000000000000..454cf5ef7ca81 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_messenger.php @@ -0,0 +1,30 @@ +loadFromExtension('framework', [ + 'mailer' => [ + 'dsn' => 'smtp://example.com', + ], + 'messenger' => [ + 'enabled' => false, + ], + 'notifier' => [ + 'enabled' => true, + 'notification_on_failed_messages' => true, + 'chatter_transports' => [ + 'slack' => 'null' + ], + 'texter_transports' => [ + 'twilio' => 'null' + ], + 'channel_policy' => [ + 'low' => ['slack'], + 'high' => ['slack', 'twilio'], + ], + 'admin_recipients' => [ + ['email' => 'test@test.de', 'phone' => '+490815',], + ] + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_transports.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_transports.php new file mode 100644 index 0000000000000..9bc87dbee2f58 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/notifier_without_transports.php @@ -0,0 +1,10 @@ +loadFromExtension('framework', [ + 'notifier' => [ + 'enabled' => true, + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier.xml new file mode 100644 index 0000000000000..47e2e2b0c1b13 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier.xml @@ -0,0 +1,21 @@ + + + + + + + + null + null + slack + twilio + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_mailer.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_mailer.xml new file mode 100644 index 0000000000000..1c62b5265b897 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_mailer.xml @@ -0,0 +1,21 @@ + + + + + + + + null + null + slack + twilio + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_messenger.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_messenger.xml new file mode 100644 index 0000000000000..c2a5134762588 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_messenger.xml @@ -0,0 +1,21 @@ + + + + + + + + null + null + slack + twilio + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_transports.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_transports.xml new file mode 100644 index 0000000000000..a1ec7863cda1a --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/notifier_without_transports.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml new file mode 100644 index 0000000000000..b77b547356df3 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier.yml @@ -0,0 +1,16 @@ +framework: + messenger: ~ + mailer: + dsn: 'smtp://example.com' + notifier: + enabled: true + notification_on_failed_messages: true + chatter_transports: + slack: 'null' + texter_transports: + twilio: 'null' + channel_policy: + low: ['slack'] + high: ['slack', 'twilio'] + admin_recipients: + - { email: 'test@test.de', phone: '+490815' } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_mailer.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_mailer.yml new file mode 100644 index 0000000000000..75fa3cf889825 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_mailer.yml @@ -0,0 +1,17 @@ +framework: + mailer: + enabled: false + messenger: + enabled: true + notifier: + enabled: true + notification_on_failed_messages: true + chatter_transports: + slack: 'null' + texter_transports: + twilio: 'null' + channel_policy: + low: ['slack'] + high: ['slack', 'twilio'] + admin_recipients: + - { email: 'test@test.de', phone: '+490815' } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_messenger.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_messenger.yml new file mode 100644 index 0000000000000..93d1f0aa190a7 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_messenger.yml @@ -0,0 +1,17 @@ +framework: + mailer: + dsn: 'smtp://example.com' + messenger: + enabled: false + notifier: + enabled: true + notification_on_failed_messages: true + chatter_transports: + slack: 'null' + texter_transports: + twilio: 'null' + channel_policy: + low: ['slack'] + high: ['slack', 'twilio'] + admin_recipients: + - { email: 'test@test.de', phone: '+490815' } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_transports.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_transports.yml new file mode 100644 index 0000000000000..856b0cd7c7a0e --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/notifier_without_transports.yml @@ -0,0 +1,3 @@ +framework: + notifier: + enabled: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 2c6713a38a3c7..b8a43474b101e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1836,6 +1836,43 @@ public function testRegisterParameterCollectingBehaviorDescribingTags() ], $container->getParameter('container.behavior_describing_tags')); } + public function testNotifierWithoutMailer() + { + $container = $this->createContainerFromFile('notifier_without_mailer'); + + $this->assertFalse($container->hasDefinition('notifier.channel.email')); + } + + public function testNotifierWithoutMessenger() + { + $container = $this->createContainerFromFile('notifier_without_messenger'); + + $this->assertFalse($container->getDefinition('notifier.failed_message_listener')->hasTag('kernel.event_subscriber')); + } + + public function testNotifierWithMailerAndMessenger() + { + $container = $this->createContainerFromFile('notifier'); + + $this->assertTrue($container->hasDefinition('notifier')); + $this->assertTrue($container->hasDefinition('chatter')); + $this->assertTrue($container->hasDefinition('texter')); + $this->assertTrue($container->hasDefinition('notifier.channel.chat')); + $this->assertTrue($container->hasDefinition('notifier.channel.email')); + $this->assertTrue($container->hasDefinition('notifier.channel.sms')); + $this->assertTrue($container->hasDefinition('notifier.channel_policy')); + $this->assertTrue($container->getDefinition('notifier.failed_message_listener')->hasTag('kernel.event_subscriber')); + } + + public function testNotifierWithoutTransports() + { + $container = $this->createContainerFromFile('notifier_without_transports'); + + $this->assertTrue($container->hasDefinition('notifier')); + $this->assertFalse($container->hasDefinition('chatter')); + $this->assertFalse($container->hasDefinition('texter')); + } + 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 18a7196181810..60b72af6d5fe7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -50,6 +50,7 @@ "symfony/mailer": "^5.2", "symfony/messenger": "^5.2", "symfony/mime": "^4.4|^5.0", + "symfony/notifier": "^5.3", "symfony/process": "^4.4|^5.0", "symfony/rate-limiter": "^5.2", "symfony/security-bundle": "^5.3", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy