Skip to content

Commit 044c21b

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: [FrameworkBundle] Fix mailer config with XML
2 parents 71c441e + 322b40a commit 044c21b

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

DependencyInjection/Configuration.php

+1
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ private function addMailerSection(ArrayNodeDefinition $rootNode, callable $enabl
21992199
->end()
22002200
->arrayNode('envelope')
22012201
->info('Mailer Envelope configuration')
2202+
->fixXmlConfig('recipient')
22022203
->children()
22032204
->scalarNode('sender')->end()
22042205
->arrayNode('recipients')

Resources/config/schema/symfony-1.0.xsd

+1-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@
781781
<xsd:complexType name="mailer_envelope">
782782
<xsd:sequence>
783783
<xsd:element name="sender" type="xsd:string" minOccurs="0" maxOccurs="1" />
784-
<xsd:element name="recipients" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
784+
<xsd:element name="recipient" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
785785
</xsd:sequence>
786786
</xsd:complexType>
787787

Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
'dsn' => 'smtp://example.com',
1313
'envelope' => [
1414
'sender' => '[email protected]',
15-
'recipients' => ['[email protected]', '[email protected]'],
15+
'recipients' => ['[email protected]'],
1616
],
1717
'headers' => [
1818
'from' => '[email protected]',

Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml

+1-2
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>[email protected]</framework:sender>
15-
<framework:recipients>[email protected]</framework:recipients>
16-
<framework:recipients>[email protected]</framework:recipients>
15+
<framework:recipient>[email protected]</framework:recipient>
1716
</framework:envelope>
1817
<framework:header name="from">[email protected]</framework:header>
1918
<framework:header name="bcc">[email protected]</framework:header>

Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml

+2-2
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>[email protected]</framework:sender>
17-
<framework:recipients>[email protected]</framework:recipients>
18-
<framework:recipients>[email protected]</framework:recipients>
17+
<framework:recipient>[email protected]</framework:recipient>
18+
<framework:recipient>[email protected]</framework:recipient>
1919
</framework:envelope>
2020
<framework:header name="from">[email protected]</framework:header>
2121
<framework:header name="bcc">[email protected]</framework:header>

Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ framework:
1010
1111
recipients:
1212
13-
1413
headers:
1514
1615

Tests/DependencyInjection/FrameworkExtensionTestCase.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public function testWorkflows()
361361
$this->assertSame('state_machine.pull_request.metadata_store', (string) $metadataStoreReference);
362362

363363
$metadataStoreDefinition = $container->getDefinition('state_machine.pull_request.metadata_store');
364-
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
364+
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
365365
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
366366

367367
$workflowMetadata = $metadataStoreDefinition->getArgument(0);
@@ -2056,21 +2056,27 @@ public function testHttpClientFullDefaultOptions()
20562056
$this->assertSame(['foo' => ['bar' => 'baz']], $defaultOptions['extra']);
20572057
}
20582058

2059-
public static function provideMailer(): array
2059+
public static function provideMailer(): iterable
20602060
{
2061-
return [
2062-
['mailer_with_dsn', ['main' => 'smtp://example.com']],
2063-
['mailer_with_transports', [
2061+
yield [
2062+
'mailer_with_dsn',
2063+
['main' => 'smtp://example.com'],
2064+
2065+
];
2066+
yield [
2067+
'mailer_with_transports',
2068+
[
20642069
'transport1' => 'smtp://example1.com',
20652070
'transport2' => 'smtp://example2.com',
2066-
]],
2071+
],
2072+
20672073
];
20682074
}
20692075

20702076
/**
20712077
* @dataProvider provideMailer
20722078
*/
2073-
public function testMailer(string $configFile, array $expectedTransports)
2079+
public function testMailer(string $configFile, array $expectedTransports, array $expectedRecipients)
20742080
{
20752081
$container = $this->createContainerFromFile($configFile);
20762082

@@ -2082,7 +2088,7 @@ public function testMailer(string $configFile, array $expectedTransports)
20822088
$this->assertTrue($container->hasDefinition('mailer.envelope_listener'));
20832089
$l = $container->getDefinition('mailer.envelope_listener');
20842090
$this->assertSame('[email protected]', $l->getArgument(0));
2085-
$this->assertSame(['[email protected]', '[email protected]'], $l->getArgument(1));
2091+
$this->assertSame($expectedRecipients, $l->getArgument(1));
20862092
$this->assertEquals(new Reference('messenger.default_bus', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('mailer.mailer')->getArgument(1));
20872093

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

0 commit comments

Comments
 (0)