MessageEncodingTest::testEncodingIsMutable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * MtMail - e-mail module for Zend Framework
4
 *
5
 * @link      http://github.com/mtymek/MtMail
6
 * @copyright Copyright (c) 2013-2017 Mateusz Tymek
7
 * @license   BSD 2-Clause
8
 */
9
10
namespace MtMailTest\Plugin;
11
12
use MtMail\Event\ComposerEvent;
13
use MtMail\ComposerPlugin\MessageEncoding;
14
use PHPUnit\Framework\TestCase;
15
use Zend\Mail\Message;
16
17
class MessageEncodingTest extends TestCase
18
{
19
    /**
20
     * @var MessageEncoding
21
     */
22
    protected $plugin;
23
24
    public function setUp()
25
    {
26
        $this->plugin = new MessageEncoding();
27
    }
28
29
    public function testPluginSetsCorrectEncoding()
30
    {
31
        $message = $this->prophesize(Message::class);
32
        $message->setEncoding('UTF-8');
33
        $event = new ComposerEvent();
34
        $event->setMessage($message->reveal());
35
        $this->plugin->setEncoding('UTF-8');
36
        $this->plugin->setMessageEncoding($event);
37
        $this->assertEquals('UTF-8', $this->plugin->getEncoding());
38
    }
39
40
    public function testEncodingIsMutable()
41
    {
42
        $this->plugin->setEncoding('UTF-8');
43
        $this->assertEquals('UTF-8', $this->plugin->getEncoding());
44
    }
45
}
46