TransportFactoryTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreatesSmtpTransportIfWanted() 0 5 1
A testEncryptionCanBeSet() 0 12 1
A testCreatesMailTransportByDefault() 0 5 1
1
<?php
2
3
namespace Common\Tests\Mailer;
4
5
use PHPUnit\Framework\TestCase;
6
use Common\Mailer\TransportFactory;
7
8
/**
9
 * Tests for our module settings
10
 */
11
class TransportFactoryTest extends TestCase
12
{
13
    public function testCreatesMailTransportByDefault(): void
14
    {
15
        self::assertInstanceOf(
16
            'Swift_SendmailTransport',
17
            TransportFactory::create()
18
        );
19
    }
20
21
    public function testCreatesSmtpTransportIfWanted(): void
22
    {
23
        self::assertInstanceOf(
24
            'Swift_SmtpTransport',
25
            TransportFactory::create('smtp')
26
        );
27
    }
28
29
    public function testEncryptionCanBeSet(): void
30
    {
31
        $transport = TransportFactory::create('smtp', null, 21, null, null, 'ssl');
32
        self::assertEquals(
33
            'ssl',
34
            $transport->getEncryption()
35
        );
36
37
        $transport = TransportFactory::create('smtp', null, 21, null, null, 'tls');
38
        self::assertEquals(
39
            'tls',
40
            $transport->getEncryption()
41
        );
42
    }
43
}
44