Skip to content

Commit f85b3ff

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Fix CS [Serializer] Fix configuration of the cache key [Messenger] Do not stack retry stamp [FrameworkBundle] Add missing mailer transports in xsd [ErrorHandler][DebugClassLoader] Add mixed and static return types support
2 parents 5551159 + 344c1b3 commit f85b3ff

File tree

8 files changed

+87
-3
lines changed

8 files changed

+87
-3
lines changed

Resources/config/schema/symfony-1.0.xsd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,17 @@
554554

555555
<xsd:complexType name="mailer">
556556
<xsd:sequence>
557+
<xsd:element name="transport" type="mailer_transport" minOccurs="0" maxOccurs="unbounded" />
557558
<xsd:element name="envelope" type="mailer_envelope" minOccurs="0" maxOccurs="1" />
558559
</xsd:sequence>
559560
<xsd:attribute name="dsn" type="xsd:string" />
560561
<xsd:attribute name="message-bus" type="xsd:string" />
561562
</xsd:complexType>
562563

564+
<xsd:complexType name="mailer_transport" mixed="true">
565+
<xsd:attribute name="name" type="xsd:string" use="required" />
566+
</xsd:complexType>
567+
563568
<xsd:complexType name="mailer_envelope">
564569
<xsd:sequence>
565570
<xsd:element name="sender" type="xsd:string" minOccurs="0" maxOccurs="1" />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
4+
5+
return static function (ContainerConfigurator $container) {
6+
$container->extension('framework', [
7+
'mailer' => [
8+
'dsn' => 'smtp://example.com',
9+
'envelope' => [
10+
'sender' => 'sender@example.org',
11+
'recipients' => ['redirected@example.org', 'redirected1@example.org'],
12+
],
13+
],
14+
]);
15+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
4+
5+
return static function (ContainerConfigurator $container) {
6+
$container->extension('framework', [
7+
'mailer' => [
8+
'transports' => [
9+
'transport1' => 'smtp://example1.com',
10+
'transport2' => 'smtp://example2.com',
11+
],
12+
'envelope' => [
13+
'sender' => 'sender@example.org',
14+
'recipients' => ['redirected@example.org', 'redirected1@example.org'],
15+
],
16+
],
17+
]);
18+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:mailer>
11+
<framework:transport name="transport1">smtp://example1.com</framework:transport>
12+
<framework:transport name="transport2">smtp://example2.com</framework:transport>
13+
<framework:envelope>
14+
<framework:sender>sender@example.org</framework:sender>
15+
<framework:recipients>redirected@example.org</framework:recipients>
16+
<framework:recipients>redirected1@example.org</framework:recipients>
17+
</framework:envelope>
18+
</framework:mailer>
19+
</framework:config>
20+
</container>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
framework:
2+
mailer:
3+
transports:
4+
transport1: 'smtp://example1.com'
5+
transport2: 'smtp://example2.com'
6+
envelope:
7+
sender: sender@example.org
8+
recipients:
9+
- redirected@example.org
10+
- redirected1@example.org

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,13 +1423,29 @@ public function testHttpClientFullDefaultOptions()
14231423
], $defaultOptions['peer_fingerprint']);
14241424
}
14251425

1426-
public function testMailer(): void
1426+
public function provideMailer(): array
1427+
{
1428+
return [
1429+
['mailer_with_dsn', ['main' => 'smtp://example.com']],
1430+
['mailer_with_transports', [
1431+
'transport1' => 'smtp://example1.com',
1432+
'transport2' => 'smtp://example2.com',
1433+
]],
1434+
];
1435+
}
1436+
1437+
/**
1438+
* @dataProvider provideMailer
1439+
*/
1440+
public function testMailer(string $configFile, array $expectedTransports): void
14271441
{
1428-
$container = $this->createContainerFromFile('mailer');
1442+
$container = $this->createContainerFromFile($configFile);
14291443

14301444
$this->assertTrue($container->hasAlias('mailer'));
1445+
$this->assertTrue($container->hasDefinition('mailer.transports'));
1446+
$this->assertSame($expectedTransports, $container->getDefinition('mailer.transports')->getArgument(0));
14311447
$this->assertTrue($container->hasDefinition('mailer.default_transport'));
1432-
$this->assertSame('smtp://example.com', $container->getDefinition('mailer.default_transport')->getArgument(0));
1448+
$this->assertSame(current($expectedTransports), $container->getDefinition('mailer.default_transport')->getArgument(0));
14331449
$this->assertTrue($container->hasDefinition('mailer.envelope_listener'));
14341450
$l = $container->getDefinition('mailer.envelope_listener');
14351451
$this->assertSame('sender@example.org', $l->getArgument(0));

0 commit comments

Comments
 (0)