Completed
Push — master ( dd1c3d...bd2aeb )
by Mateusz
40s
created

ManagerTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 40
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testValidatePluginThrowsExceptionWhenClassIsInvalid() 0 4 1
A testValidatePluginDoesNothingIfPluginIsValid() 0 5 1
A testValidateThrowsExceptionWhenClassIsInvalid() 0 4 1
A testValidateDoesNothingIfPluginIsValid() 0 5 1
1
<?php
2
/**
3
 * MtMail - e-mail module for Zend Framework 2
4
 *
5
 * @link      http://github.com/mtymek/MtMail
6
 * @copyright Copyright (c) 2013-2014 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 Zend\ServiceManager\ServiceManager;
15
16
class ManagerTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var TemplateManager
20
     */
21
    protected $manager;
22
23
    public function setUp()
24
    {
25
        $this->manager = new TemplateManager(new ServiceManager());
26
    }
27
28
    /**
29
     * @expectedException RuntimeException
30
     */
31
    public function testValidatePluginThrowsExceptionWhenClassIsInvalid()
32
    {
33
        $this->manager->validatePlugin(new \stdClass());
34
    }
35
36
    public function testValidatePluginDoesNothingIfPluginIsValid()
37
    {
38
        $mock = $this->getMock('MtMail\Template\TemplateInterface');
39
        $this->manager->validatePlugin($mock);
40
    }
41
42
    /**
43
     * @expectedException RuntimeException
44
     */
45
    public function testValidateThrowsExceptionWhenClassIsInvalid()
46
    {
47
        $this->manager->validate(new \stdClass());
48
    }
49
50
    public function testValidateDoesNothingIfPluginIsValid()
51
    {
52
        $mock = $this->getMock('MtMail\Template\TemplateInterface');
53
        $this->manager->validate($mock);
54
    }
55
}
56