bug #37159 [Mailer] Fixed generator bug when creating multiple transports using Transport::fromDsn (atailouloute)
This PR was submitted for the master branch but it was merged into the 4.4 branch instead.
Discussion
----------
[Mailer] Fixed generator bug when creating multiple transports using Transport::fromDsn
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #37158
| License | MIT
| Doc PR | N/A
Commits
-------
c5833fa784
[Mailer] Fixed generator bug when creating multiple transports using Transport::fromDsn
This commit is contained in:
commit
9b132bcb87
|
@ -60,6 +60,22 @@ class TransportTest extends TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider fromDsnProvider
|
||||
*/
|
||||
public function testFromDsn(string $dsn, TransportInterface $transport): void
|
||||
{
|
||||
$this->assertEquals($transport, Transport::fromDsn($dsn));
|
||||
}
|
||||
|
||||
public function fromDsnProvider(): iterable
|
||||
{
|
||||
yield 'multiple transports' => [
|
||||
'failover(smtp://a smtp://b)',
|
||||
new FailoverTransport([new Transport\Smtp\EsmtpTransport('a'), new Transport\Smtp\EsmtpTransport('b')]),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider fromWrongStringProvider
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ class Transport
|
|||
|
||||
public static function fromDsn(string $dsn, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null): TransportInterface
|
||||
{
|
||||
$factory = new self(self::getDefaultFactories($dispatcher, $client, $logger));
|
||||
$factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client, $logger)));
|
||||
|
||||
return $factory->fromString($dsn);
|
||||
}
|
||||
|
|
Reference in New Issue