diff --git a/Resources/config/schema/monolog-1.0.xsd b/Resources/config/schema/monolog-1.0.xsd index 84b5d98d..85c7b30f 100644 --- a/Resources/config/schema/monolog-1.0.xsd +++ b/Resources/config/schema/monolog-1.0.xsd @@ -25,6 +25,7 @@ + diff --git a/Tests/DependencyInjection/FixtureMonologExtensionTest.php b/Tests/DependencyInjection/FixtureMonologExtensionTest.php index c4f50c80..afdfd819 100644 --- a/Tests/DependencyInjection/FixtureMonologExtensionTest.php +++ b/Tests/DependencyInjection/FixtureMonologExtensionTest.php @@ -136,6 +136,28 @@ public function testHandlersWithChannels() ); } + public function testSingleEmailRecipient() + { + $container = $this->getContainer('single_email_recipient'); + + $this->assertSame(array( + array('setFrom', array('error@example.com')), + array('setTo', array(array('error@example.com'))), + array('setSubject', array('An Error Occurred!')), + ), $container->getDefinition('monolog.handler.swift.mail_prototype')->getMethodCalls()); + } + + public function testMultipleEmailRecipients() + { + $container = $this->getContainer('multiple_email_recipients'); + + $this->assertSame(array( + array('setFrom', array('error@example.com')), + array('setTo', array(array('dev1@example.com', 'dev2@example.com'))), + array('setSubject', array('An Error Occurred!')), + ), $container->getDefinition('monolog.handler.swift.mail_prototype')->getMethodCalls()); + } + protected function getContainer($fixture) { $container = new ContainerBuilder(); diff --git a/Tests/DependencyInjection/Fixtures/xml/multiple_email_recipients.xml b/Tests/DependencyInjection/Fixtures/xml/multiple_email_recipients.xml new file mode 100644 index 00000000..c7e5c99b --- /dev/null +++ b/Tests/DependencyInjection/Fixtures/xml/multiple_email_recipients.xml @@ -0,0 +1,20 @@ + + + + + + + dev1@example.com + dev2@example.com + + + diff --git a/Tests/DependencyInjection/Fixtures/xml/single_email_recipient.xml b/Tests/DependencyInjection/Fixtures/xml/single_email_recipient.xml new file mode 100644 index 00000000..74ca9230 --- /dev/null +++ b/Tests/DependencyInjection/Fixtures/xml/single_email_recipient.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/Tests/DependencyInjection/Fixtures/yml/multiple_email_recipients.yml b/Tests/DependencyInjection/Fixtures/yml/multiple_email_recipients.yml new file mode 100644 index 00000000..2e1bb640 --- /dev/null +++ b/Tests/DependencyInjection/Fixtures/yml/multiple_email_recipients.yml @@ -0,0 +1,8 @@ +monolog: + handlers: + swift: + type: swift_mailer + from_email: error@example.com + to_email: [dev1@example.com, dev2@example.com] + subject: An Error Occurred! + level: debug diff --git a/Tests/DependencyInjection/Fixtures/yml/single_email_recipient.yml b/Tests/DependencyInjection/Fixtures/yml/single_email_recipient.yml new file mode 100644 index 00000000..83642be0 --- /dev/null +++ b/Tests/DependencyInjection/Fixtures/yml/single_email_recipient.yml @@ -0,0 +1,8 @@ +monolog: + handlers: + swift: + type: swift_mailer + from_email: error@example.com + to_email: error@example.com + subject: An Error Occurred! + level: debug