Skip to content

Commit 077a539

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [FrameworkBundle] Fix mailer config with XML
2 parents 27ebcb2 + 044c21b commit 077a539

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
@@ -2074,6 +2074,7 @@ private function addMailerSection(ArrayNodeDefinition $rootNode, callable $enabl
20742074
->end()
20752075
->arrayNode('envelope')
20762076
->info('Mailer Envelope configuration')
2077+
->fixXmlConfig('recipient')
20772078
->children()
20782079
->scalarNode('sender')->end()
20792080
->arrayNode('recipients')

Resources/config/schema/symfony-1.0.xsd

+1-1
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@
755755
<xsd:complexType name="mailer_envelope">
756756
<xsd:sequence>
757757
<xsd:element name="sender" type="xsd:string" minOccurs="0" maxOccurs="1" />
758-
<xsd:element name="recipients" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
758+
<xsd:element name="recipient" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
759759
</xsd:sequence>
760760
</xsd:complexType>
761761

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
@@ -355,7 +355,7 @@ public function testWorkflows()
355355
$this->assertSame('state_machine.pull_request.metadata_store', (string) $metadataStoreReference);
356356

357357
$metadataStoreDefinition = $container->getDefinition('state_machine.pull_request.metadata_store');
358-
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
358+
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
359359
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
360360

361361
$workflowMetadata = $metadataStoreDefinition->getArgument(0);
@@ -1989,21 +1989,27 @@ public function testHttpClientFullDefaultOptions()
19891989
$this->assertSame(['foo' => ['bar' => 'baz']], $defaultOptions['extra']);
19901990
}
19911991

1992-
public static function provideMailer(): array
1992+
public static function provideMailer(): iterable
19931993
{
1994-
return [
1995-
['mailer_with_dsn', ['main' => 'smtp://example.com']],
1996-
['mailer_with_transports', [
1994+
yield [
1995+
'mailer_with_dsn',
1996+
['main' => 'smtp://example.com'],
1997+
1998+
];
1999+
yield [
2000+
'mailer_with_transports',
2001+
[
19972002
'transport1' => 'smtp://example1.com',
19982003
'transport2' => 'smtp://example2.com',
1999-
]],
2004+
],
2005+
20002006
];
20012007
}
20022008

20032009
/**
20042010
* @dataProvider provideMailer
20052011
*/
2006-
public function testMailer(string $configFile, array $expectedTransports)
2012+
public function testMailer(string $configFile, array $expectedTransports, array $expectedRecipients)
20072013
{
20082014
$container = $this->createContainerFromFile($configFile);
20092015

@@ -2015,7 +2021,7 @@ public function testMailer(string $configFile, array $expectedTransports)
20152021
$this->assertTrue($container->hasDefinition('mailer.envelope_listener'));
20162022
$l = $container->getDefinition('mailer.envelope_listener');
20172023
$this->assertSame('[email protected]', $l->getArgument(0));
2018-
$this->assertSame(['[email protected]', '[email protected]'], $l->getArgument(1));
2024+
$this->assertSame($expectedRecipients, $l->getArgument(1));
20192025
$this->assertEquals(new Reference('messenger.default_bus', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('mailer.mailer')->getArgument(1));
20202026

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

0 commit comments

Comments
 (0)