[Mailer] Fixed generator bug when creating multiple transports using Transport::fromDsn
This commit is contained in:
parent
017af041f8
commit
c5833fa784
@ -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
Block a user