From c21df9b50ab7ef072b007c63406f5a249b7fdfac Mon Sep 17 00:00:00 2001 From: Laurent VOULLEMIER Date: Sun, 16 Aug 2020 23:16:09 +0200 Subject: [PATCH] [FrameworkBundle] Add missing mailer transports in xsd --- .../Resources/config/schema/symfony-1.0.xsd | 5 +++++ .../Fixtures/php/mailer_with_dsn.php | 15 +++++++++++++ .../Fixtures/php/mailer_with_transports.php | 18 +++++++++++++++ .../xml/{mailer.xml => mailer_with_dsn.xml} | 0 .../Fixtures/xml/mailer_with_transports.xml | 20 +++++++++++++++++ .../yml/{mailer.yml => mailer_with_dsn.yml} | 0 .../Fixtures/yml/mailer_with_transports.yml | 10 +++++++++ .../FrameworkExtensionTest.php | 22 ++++++++++++++++--- 8 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php rename src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/{mailer.xml => mailer_with_dsn.xml} (100%) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml rename src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/{mailer.yml => mailer_with_dsn.yml} (100%) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml 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 0a7a56f675..5931d1261b 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 @@ -571,11 +571,16 @@ + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php new file mode 100644 index 0000000000..7eec06a9a0 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php @@ -0,0 +1,15 @@ +extension('framework', [ + 'mailer' => [ + 'dsn' => 'smtp://example.com', + 'envelope' => [ + 'sender' => 'sender@example.org', + 'recipients' => ['redirected@example.org', 'redirected1@example.org'], + ], + ], + ]); +}; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php new file mode 100644 index 0000000000..1bc79f3dd2 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php @@ -0,0 +1,18 @@ +extension('framework', [ + 'mailer' => [ + 'transports' => [ + 'transport1' => 'smtp://example1.com', + 'transport2' => 'smtp://example2.com', + ], + 'envelope' => [ + 'sender' => 'sender@example.org', + 'recipients' => ['redirected@example.org', 'redirected1@example.org'], + ], + ], + ]); +}; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml rename to src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml new file mode 100644 index 0000000000..a6eb67dc81 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml @@ -0,0 +1,20 @@ + + + + + + + smtp://example1.com + smtp://example2.com + + sender@example.org + redirected@example.org + redirected1@example.org + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml rename to src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml new file mode 100644 index 0000000000..6035988d76 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml @@ -0,0 +1,10 @@ +framework: + mailer: + transports: + transport1: 'smtp://example1.com' + transport2: 'smtp://example2.com' + envelope: + sender: sender@example.org + recipients: + - redirected@example.org + - redirected1@example.org diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 73cc81c480..1bc157079c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1617,13 +1617,29 @@ abstract class FrameworkExtensionTest extends TestCase ], $defaultOptions['peer_fingerprint']); } - public function testMailer(): void + public function provideMailer(): array { - $container = $this->createContainerFromFile('mailer'); + return [ + ['mailer_with_dsn', ['main' => 'smtp://example.com']], + ['mailer_with_transports', [ + 'transport1' => 'smtp://example1.com', + 'transport2' => 'smtp://example2.com', + ]], + ]; + } + + /** + * @dataProvider provideMailer + */ + public function testMailer(string $configFile, array $expectedTransports): void + { + $container = $this->createContainerFromFile($configFile); $this->assertTrue($container->hasAlias('mailer')); + $this->assertTrue($container->hasDefinition('mailer.transports')); + $this->assertSame($expectedTransports, $container->getDefinition('mailer.transports')->getArgument(0)); $this->assertTrue($container->hasDefinition('mailer.default_transport')); - $this->assertSame('smtp://example.com', $container->getDefinition('mailer.default_transport')->getArgument(0)); + $this->assertSame(current($expectedTransports), $container->getDefinition('mailer.default_transport')->getArgument(0)); $this->assertTrue($container->hasDefinition('mailer.envelope_listener')); $l = $container->getDefinition('mailer.envelope_listener'); $this->assertSame('sender@example.org', $l->getArgument(0));