Skip to content

Commit 134f2dc

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [FrameworkBundle] Fix mailer config with XML
2 parents 6f67094 + 077a539 commit 134f2dc

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,7 @@ private function addMailerSection(ArrayNodeDefinition $rootNode, callable $enabl
21162116
->end()
21172117
->arrayNode('envelope')
21182118
->info('Mailer Envelope configuration')
2119+
->fixXmlConfig('recipient')
21192120
->children()
21202121
->scalarNode('sender')->end()
21212122
->arrayNode('recipients')

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@
763763
<xsd:complexType name="mailer_envelope">
764764
<xsd:sequence>
765765
<xsd:element name="sender" type="xsd:string" minOccurs="0" maxOccurs="1" />
766-
<xsd:element name="recipients" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
766+
<xsd:element name="recipient" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
767767
</xsd:sequence>
768768
</xsd:complexType>
769769

Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
'dsn' => 'smtp://example.com',
1313
'envelope' => [
1414
'sender' => 'sender@example.org',
15-
'recipients' => ['redirected@example.org', 'redirected1@example.org'],
15+
'recipients' => ['redirected@example.org'],
1616
],
1717
'headers' => [
1818
'from' => 'from@example.org',

Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
<framework:mailer dsn="smtp://example.com">
1313
<framework:envelope>
1414
<framework:sender>sender@example.org</framework:sender>
15-
<framework:recipients>redirected@example.org</framework:recipients>
16-
<framework:recipients>redirected1@example.org</framework:recipients>
15+
<framework:recipient>redirected@example.org</framework:recipient>
1716
</framework:envelope>
1817
<framework:header name="from">from@example.org</framework:header>
1918
<framework:header name="bcc">bcc1@example.org</framework:header>

Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<framework:transport name="transport2">smtp://example2.com</framework:transport>
1515
<framework:envelope>
1616
<framework:sender>sender@example.org</framework:sender>
17-
<framework:recipients>redirected@example.org</framework:recipients>
18-
<framework:recipients>redirected1@example.org</framework:recipients>
17+
<framework:recipient>redirected@example.org</framework:recipient>
18+
<framework:recipient>redirected1@example.org</framework:recipient>
1919
</framework:envelope>
2020
<framework:header name="from">from@example.org</framework:header>
2121
<framework:header name="bcc">bcc1@example.org</framework:header>

Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ framework:
1010
sender: sender@example.org
1111
recipients:
1212
- redirected@example.org
13-
- redirected1@example.org
1413
headers:
1514
from: from@example.org
1615
bcc: [bcc1@example.org, bcc2@example.org]

Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,21 +2037,27 @@ public function testHttpClientRateLimiter()
20372037
$this->assertSame('foo.throttling.limiter', (string) $arguments[1]);
20382038
}
20392039

2040-
public static function provideMailer(): array
2040+
public static function provideMailer(): iterable
20412041
{
2042-
return [
2043-
['mailer_with_dsn', ['main' => 'smtp://example.com']],
2044-
['mailer_with_transports', [
2042+
yield [
2043+
'mailer_with_dsn',
2044+
['main' => 'smtp://example.com'],
2045+
['redirected@example.org'],
2046+
];
2047+
yield [
2048+
'mailer_with_transports',
2049+
[
20452050
'transport1' => 'smtp://example1.com',
20462051
'transport2' => 'smtp://example2.com',
2047-
]],
2052+
],
2053+
['redirected@example.org', 'redirected1@example.org'],
20482054
];
20492055
}
20502056

20512057
/**
20522058
* @dataProvider provideMailer
20532059
*/
2054-
public function testMailer(string $configFile, array $expectedTransports)
2060+
public function testMailer(string $configFile, array $expectedTransports, array $expectedRecipients)
20552061
{
20562062
$container = $this->createContainerFromFile($configFile);
20572063

@@ -2063,7 +2069,7 @@ public function testMailer(string $configFile, array $expectedTransports)
20632069
$this->assertTrue($container->hasDefinition('mailer.envelope_listener'));
20642070
$l = $container->getDefinition('mailer.envelope_listener');
20652071
$this->assertSame('sender@example.org', $l->getArgument(0));
2066-
$this->assertSame(['redirected@example.org', 'redirected1@example.org'], $l->getArgument(1));
2072+
$this->assertSame($expectedRecipients, $l->getArgument(1));
20672073
$this->assertEquals(new Reference('messenger.default_bus', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('mailer.mailer')->getArgument(1));
20682074

20692075
$this->assertTrue($container->hasDefinition('mailer.message_listener'));

0 commit comments

Comments
 (0)