testValidateThrowsExceptionIfPluginIsInvalid()   A
last analyzed

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
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\Service;
11
12
use MtMail\Exception\RuntimeException;
13
use MtMail\SenderPlugin\PluginInterface;
14
use MtMail\Service\SenderPluginManager;
15
use PHPUnit\Framework\TestCase;
16
use stdClass;
17
use Zend\ServiceManager\ServiceManager;
18
19
class SenderPluginManagerTest extends TestCase
20
{
21
    /**
22
     * @var SenderPluginManager
23
     */
24
    protected $pluginManager;
25
26
    public function setUp()
27
    {
28
        $this->pluginManager = new SenderPluginManager(new ServiceManager());
29
    }
30
31
    /**
32
     * @expectedException RuntimeException
33
     */
34
    public function testValidatePluginThrowsExceptionIfPluginIsInvalid()
35
    {
36
        $this->pluginManager->validatePlugin(new stdClass());
37
    }
38
39
    public function testValidatePluginDoesNothingIfPluginIsValid()
40
    {
41
        $mock = $this->prophesize(PluginInterface::class);
42
        $this->pluginManager->validatePlugin($mock->reveal());
43
        $this->assertTrue(true);
44
    }
45
46
    /**
47
     * @expectedException RuntimeException
48
     */
49
    public function testValidateThrowsExceptionIfPluginIsInvalid()
50
    {
51
        $this->pluginManager->validate(new stdClass());
52
    }
53
54
    public function testValidateDoesNothingIfPluginIsValid()
55
    {
56
        $mock = $this->prophesize(PluginInterface::class);
57
        $this->pluginManager->validate($mock->reveal());
58
        $this->assertTrue(true);
59
    }
60
}
61