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

SenderPluginManagerTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
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 testValidatePluginThrowsExceptionIfPluginIsInvalid() 0 4 1
A testValidatePluginDoesNothingIfPluginIsValid() 0 5 1
A testValidateThrowsExceptionIfPluginIsInvalid() 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\Service;
11
12
use MtMail\Exception\RuntimeException;
13
use MtMail\Service\SenderPluginManager;
14
use PHPUnit_Framework_TestCase;
15
use stdClass;
16
use Zend\ServiceManager\ServiceManager;
17
18
class SenderPluginManagerTest extends PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * @var SenderPluginManager
22
     */
23
    protected $pluginManager;
24
25
    public function setUp()
26
    {
27
        $this->pluginManager = new SenderPluginManager(new ServiceManager());
28
    }
29
30
    /**
31
     * @expectedException RuntimeException
32
     */
33
    public function testValidatePluginThrowsExceptionIfPluginIsInvalid()
34
    {
35
        $this->pluginManager->validatePlugin(new stdClass());
36
    }
37
38
    public function testValidatePluginDoesNothingIfPluginIsValid()
39
    {
40
        $mock = $this->getMock('MtMail\SenderPlugin\PluginInterface');
41
        $this->pluginManager->validatePlugin($mock);
42
    }
43
44
    /**
45
     * @expectedException RuntimeException
46
     */
47
    public function testValidateThrowsExceptionIfPluginIsInvalid()
48
    {
49
        $this->pluginManager->validate(new stdClass());
50
    }
51
52
    public function testValidateDoesNothingIfPluginIsValid()
53
    {
54
        $mock = $this->getMock('MtMail\SenderPlugin\PluginInterface');
55
        $this->pluginManager->validate($mock);
56
    }
57
}
58