|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace FH\Bundle\MailerBundle\Tests\Transport\Smtp; |
|
6
|
|
|
|
|
7
|
|
|
use FH\Bundle\MailerBundle\Transport\Smtp\PlainSmtpTransportFactory; |
|
8
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
|
|
9
|
|
|
use Symfony\Component\Mailer\Transport\Dsn; |
|
10
|
|
|
use Symfony\Component\Mailer\Transport\Smtp\SmtpTransport; |
|
11
|
|
|
use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @covers \FH\Bundle\MailerBundle\Transport\Smtp\PlainSmtpTransportFactory |
|
15
|
|
|
*/ |
|
16
|
|
|
final class PlainSmtpTransportFactoryTest extends TestCase |
|
17
|
|
|
{ |
|
18
|
|
|
/** @var PlainSmtpTransportFactory */ |
|
19
|
|
|
private $factory; |
|
20
|
|
|
|
|
21
|
|
|
protected function setUp(): void |
|
22
|
|
|
{ |
|
23
|
|
|
$this->factory = new PlainSmtpTransportFactory(); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function testSupported(): void |
|
27
|
|
|
{ |
|
28
|
|
|
$dsn = new Dsn('plainsmtp', 'localhost'); |
|
29
|
|
|
|
|
30
|
|
|
$supports = $this->factory->supports($dsn); |
|
31
|
|
|
|
|
32
|
|
|
$this->assertTrue($supports); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function testUnsupported(): void |
|
36
|
|
|
{ |
|
37
|
|
|
$dsn = new Dsn('smtp', 'localhost'); |
|
38
|
|
|
|
|
39
|
|
|
$supports = $this->factory->supports($dsn); |
|
40
|
|
|
|
|
41
|
|
|
$this->assertFalse($supports); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function testCreateTransport(): void |
|
45
|
|
|
{ |
|
46
|
|
|
$dsn = new Dsn('plainsmtp', 'localhost'); |
|
47
|
|
|
$transport = $this->factory->create($dsn); |
|
48
|
|
|
/** @var SocketStream $stream */ |
|
49
|
|
|
$stream = $transport->getStream(); |
|
50
|
|
|
|
|
51
|
|
|
$this->assertInstanceOf(SmtpTransport::class, $transport); |
|
52
|
|
|
$this->assertSame('localhost', $stream->getHost()); |
|
53
|
|
|
$this->assertSame(25, $stream->getPort()); |
|
54
|
|
|
$this->assertFalse($stream->isTLS(), 'TLS should not be enabled'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function testCreateTransportNoDefaultPort(): void |
|
58
|
|
|
{ |
|
59
|
|
|
$dsn = new Dsn('plainsmtp', 'localhost', null, null, 30); |
|
60
|
|
|
$transport = $this->factory->create($dsn); |
|
61
|
|
|
/** @var SocketStream $stream */ |
|
62
|
|
|
$stream = $transport->getStream(); |
|
63
|
|
|
|
|
64
|
|
|
$this->assertInstanceOf(SmtpTransport::class, $transport); |
|
65
|
|
|
$this->assertSame('localhost', $stream->getHost()); |
|
66
|
|
|
$this->assertSame(30, $stream->getPort()); |
|
67
|
|
|
$this->assertFalse($stream->isTLS(), 'TLS should not be enabled'); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths