Passed
Pull Request — develop (#11)
by Misha
03:05
created

EmailComposerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 21
c 1
b 0
f 1
dl 0
loc 34
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testReturnedMessageType() 0 5 1
A setUp() 0 20 1
1
<?php
2
declare(strict_types=1);
3
4
namespace FH\Bundle\MailerBundle\Tests\Composer;
5
6
use FH\Bundle\MailerBundle\Composer\EmailComposer;
7
use FH\Bundle\MailerBundle\Email\MessageOptions;
8
use FH\Bundle\MailerBundle\Email\Participants;
9
use PHPUnit\Framework\TestCase;
10
use Symfony\Component\Mime\Address;
11
use Symfony\Component\Mime\Email;
12
13
/**
14
 * @covers \FH\Bundle\MailerBundle\Composer\EmailComposer
15
 */
16
final class EmailComposerTest extends TestCase
17
{
18
    private $sender;
19
    private $to;
20
    private $messageOptions;
21
    private $emailComposer;
22
23
    protected function setUp(): void
24
    {
25
        $this->sender = new Address('[email protected]', 'Mr. Test');
26
        $this->to = new Address('[email protected]', 'Ms. Test');
27
28
        $this->messageOptions = new MessageOptions(
29
            'Test email',
30
            null,
31
            null,
32
            new Participants(
33
                $this->sender,
34
                [$this->sender],
35
                [$this->sender],
36
                [$this->to],
37
                [$this->to],
38
                [$this->to]
39
            )
40
        );
41
42
        $this->emailComposer = new EmailComposer($this->messageOptions);
43
    }
44
45
    public function testReturnedMessageType(): void
46
    {
47
        $email = $this->emailComposer->compose([]);
48
49
        $this->assertInstanceOf(Email::class, $email);
50
    }
51
}
52