Skip to content

Commit b0ec323

Browse files
committed
[Mailer] added XML configuration for the mailer envelope
1 parent 6918e4e commit b0ec323

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

Resources/config/schema/symfony-1.0.xsd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,16 @@
555555
</xsd:complexType>
556556

557557
<xsd:complexType name="mailer">
558+
<xsd:sequence>
559+
<xsd:element name="envelope" type="mailer_envelope" minOccurs="0" maxOccurs="1" />
560+
</xsd:sequence>
558561
<xsd:attribute name="dsn" type="xsd:string" />
559562
</xsd:complexType>
563+
564+
<xsd:complexType name="mailer_envelope">
565+
<xsd:sequence>
566+
<xsd:element name="sender" type="xsd:string" />
567+
<xsd:element name="recipients" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
568+
</xsd:sequence>
569+
</xsd:complexType>
560570
</xsd:schema>

Tests/DependencyInjection/Fixtures/php/mailer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@
33
$container->loadFromExtension('framework', [
44
'mailer' => [
55
'dsn' => 'smtp://example.com',
6+
'envelope' => [
7+
'sender' => '[email protected]',
8+
'recipients' => ['[email protected]', '[email protected]'],
9+
],
610
],
711
]);

Tests/DependencyInjection/Fixtures/xml/mailer.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
88

99
<framework:config>
10-
<framework:mailer dsn="smtp://example.com" />
10+
<framework:mailer dsn="smtp://example.com">
11+
<framework:envelope>
12+
<framework:sender>[email protected]</framework:sender>
13+
<framework:recipients>[email protected]</framework:recipients>
14+
<framework:recipients>[email protected]</framework:recipients>
15+
</framework:envelope>
16+
</framework:mailer>
1117
</framework:config>
1218
</container>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
framework:
22
mailer:
33
dsn: 'smtp://example.com'
4+
envelope:
5+
6+
recipients:
7+
8+

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,10 @@ public function testMailer(): void
15881588
$this->assertTrue($container->hasAlias('mailer'));
15891589
$this->assertTrue($container->hasDefinition('mailer.default_transport'));
15901590
$this->assertSame('smtp://example.com', $container->getDefinition('mailer.default_transport')->getArgument(0));
1591+
$this->assertTrue($container->hasDefinition('mailer.envelope_listener'));
1592+
$l = $container->getDefinition('mailer.envelope_listener');
1593+
$this->assertSame('[email protected]', $l->getArgument(0));
1594+
$this->assertSame(['[email protected]', '[email protected]'], $l->getArgument(1));
15911595
}
15921596

15931597
protected function createContainer(array $data = [])

0 commit comments

Comments
 (0)