Skip to content

Commit

Permalink
[Mailer] Fixed generator bug when creating multiple transports using …
Browse files Browse the repository at this point in the history
…Transport::fromDsn
  • Loading branch information
atailouloute committed Jun 8, 2020
1 parent 3755efd commit 5d9bc15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Symfony/Component/Mailer/Tests/TransportTest.php
Expand Up @@ -60,6 +60,22 @@ public function fromStringProvider(): iterable
];
}

/**
* @dataProvider fromDnsProvider
*/
public function testFromDsn(string $dsn, TransportInterface $transport): void
{
$this->assertEquals($transport, Transport::fromDsn($dsn));
}

public function fromDnsProvider(): iterable
{
yield 'multiple transport' => [
'failover(smtp://a smtp://b)',
new FailoverTransport([new Transport\Smtp\EsmtpTransport('a'), new Transport\Smtp\EsmtpTransport('b')]),
];
}

/**
* @dataProvider fromWrongStringProvider
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Mailer/Transport.php
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5d9bc15

Please sign in to comment.