MessageEncodingTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 4
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testPluginSetsCorrectEncoding() 0 10 1
A testEncodingIsMutable() 0 5 1
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