From 75c1c0c062d8d64834a8675ea8349915d490d9d6 Mon Sep 17 00:00:00 2001 From: Benjamin Laugueux Date: Wed, 24 Apr 2013 13:24:21 +0200 Subject: [PATCH] Added mailer configuration. --- DependencyInjection/Configuration.php | 1 + DependencyInjection/MonologExtension.php | 2 +- Tests/DependencyInjection/ConfigurationTest.php | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index c726df39..d1cda06a 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -105,6 +105,7 @@ public function getConfigTreeBuilder() ->end() ->scalarNode('subject')->end() // swift_mailer and native_mailer ->scalarNode('content_type')->defaultNull()->end() // swift_mailer + ->scalarNode('mailer')->defaultValue('mailer')->end() // swift_mailer ->arrayNode('email_prototype') // swift_mailer ->canBeUnset() ->beforeNormalization() diff --git a/DependencyInjection/MonologExtension.php b/DependencyInjection/MonologExtension.php index 6b7f71b8..5c1a50f3 100644 --- a/DependencyInjection/MonologExtension.php +++ b/DependencyInjection/MonologExtension.php @@ -251,7 +251,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler $prototype = new Reference($messageId); } $definition->setArguments(array( - new Reference('mailer'), + new Reference($handler['mailer']), $prototype, $handler['level'], $handler['bubble'], diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 3c0af8b7..d14ca127 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -196,6 +196,7 @@ public function testWithSwiftMailerHandler() 'from_email' => 'foo@bar.com', 'to_email' => 'foo@bar.com', 'subject' => 'Subject', + 'mailer' => 'mailer', 'email_prototype' => array( 'id' => 'monolog.prototype', 'method' => 'getPrototype' @@ -211,6 +212,7 @@ public function testWithSwiftMailerHandler() $this->assertCount(2, $config['handlers']['swift']['email_prototype']); $this->assertEquals('monolog.prototype', $config['handlers']['swift']['email_prototype']['id']); $this->assertEquals('getPrototype', $config['handlers']['swift']['email_prototype']['method']); + $this->assertEquals('mailer', $config['handlers']['swift']['mailer']); } public function testWithType()