ManagerTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 42
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testValidatePluginThrowsExceptionWhenClassIsInvalid() 0 4 1
A testValidatePluginDoesNothingIfPluginIsValid() 0 6 1
A testValidateThrowsExceptionWhenClassIsInvalid() 0 4 1
A testValidateDoesNothingIfPluginIsValid() 0 6 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\Template;
11
12
use MtMail\Exception\RuntimeException;
13
use MtMail\Service\TemplateManager;
14
use MtMail\Template\TemplateInterface;
15
use Zend\ServiceManager\ServiceManager;
16
17
class ManagerTest extends \PHPUnit\Framework\TestCase
18
{
19
    /**
20
     * @var TemplateManager
21
     */
22
    protected $manager;
23
24
    public function setUp()
25
    {
26
        $this->manager = new TemplateManager(new ServiceManager());
27
    }
28
29
    /**
30
     * @expectedException RuntimeException
31
     */
32
    public function testValidatePluginThrowsExceptionWhenClassIsInvalid()
33
    {
34
        $this->manager->validatePlugin(new \stdClass());
35
    }
36
37
    public function testValidatePluginDoesNothingIfPluginIsValid()
38
    {
39
        $mock = $this->prophesize(TemplateInterface::class);
40
        $this->manager->validatePlugin($mock->reveal());
41
        $this->assertTrue(true);
42
    }
43
44
    /**
45
     * @expectedException RuntimeException
46
     */
47
    public function testValidateThrowsExceptionWhenClassIsInvalid()
48
    {
49
        $this->manager->validate(new \stdClass());
50
    }
51
52
    public function testValidateDoesNothingIfPluginIsValid()
53
    {
54
        $mock = $this->prophesize(TemplateInterface::class);
55
        $this->manager->validate($mock->reveal());
56
        $this->assertTrue(true);
57
    }
58
}
59