Completed
Pull Request — develop (#11)
by Misha
03:14 queued 34s
created

EmailComposerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 21
dl 0
loc 37
rs 10
c 1
b 0
f 1
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
final class EmailComposerTest extends TestCase
14
{
15
    private $sender;
16
    private $to;
17
    private $messageOptions;
18
    private $emailComposer;
19
20
    protected function setUp(): void
21
    {
22
        $this->sender = new Address('[email protected]', 'Mr. Test');
23
        $this->to = new Address('[email protected]', 'Ms. Test');
24
25
        $this->messageOptions = new MessageOptions(
26
            'Test email',
27
            null,
28
            null,
29
            new Participants(
30
                $this->sender,
31
                [$this->sender],
32
                [$this->sender],
33
                [$this->to],
34
                [$this->to],
35
                [$this->to]
36
            )
37
        );
38
39
        $this->emailComposer = new EmailComposer($this->messageOptions);
40
    }
41
42
    /**
43
     * @covers \FH\Bundle\MailerBundle\Composer\EmailComposer
44
     */
45
    public function testReturnedMessageType(): void
46
    {
47
        $email = $this->emailComposer->compose([]);
48
49
        $this->assertInstanceOf(Email::class, $email);
50
    }
51
}
52