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

testValidateThrowsExceptionIfPluginIsInvalid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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