Skip to content

Commit

Permalink
[11.x] Test Improvements
Browse files Browse the repository at this point in the history
Add additional tests to verify scheme and port configuration usage to
configure `symfony/mailer`

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 29, 2024
1 parent f49cba4 commit b89f519
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/Mail/MailManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ public function testEmptyTransportConfig($transport)
$this->app['mail.manager']->mailer('custom_smtp');
}

#[TestWith(['smtp'])]
#[TestWith(['smtps'])]
public function testMailUrlConfig($scheme)
#[TestWith([null, 5876])]
#[TestWith([null, 465])]
#[TestWith(['smtp', 25])]
#[TestWith(['smtp', 2525])]
#[TestWith(['smtps', 465])]
#[TestWith(['smtp', 465])]
public function testMailUrlConfig($scheme, $port)
{
$this->app['config']->set('mail.mailers.smtp_url', [
'scheme' => $scheme,
'url' => 'smtp://usr:pwd@127.0.0.2:5876',
'url' => "smtp://usr:pwd@127.0.0.2:{$port}",
]);

$mailer = $this->app['mail.manager']->mailer('smtp_url');
Expand All @@ -44,7 +48,8 @@ public function testMailUrlConfig($scheme)
$this->assertSame('usr', $transport->getUsername());
$this->assertSame('pwd', $transport->getPassword());
$this->assertSame('127.0.0.2', $transport->getStream()->getHost());
$this->assertSame(5876, $transport->getStream()->getPort());
$this->assertSame($port, $transport->getStream()->getPort());
$this->assertSame($port === 465, $transport->getStream()->isTLS());
}

public function testBuild()
Expand Down

0 comments on commit b89f519

Please sign in to comment.