Completed
Push — master ( 5f7cbd...b12d8e )
by Alejandro
03:03
created

ErrorHandlerManagerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 12 1
A callablesAreReturned() 0 5 1
A nonCallablesThrowException() 0 4 1
1
<?php
2
namespace AcelayaTest\ExpressiveErrorHandler\ErrorHandler;
3
4
use Acelaya\ExpressiveErrorHandler\ErrorHandler\ErrorHandlerManager;
5
use PHPUnit_Framework_TestCase as TestCase;
6
use Zend\ServiceManager\ServiceManager;
7
8
class ErrorHandlerManagerTest extends TestCase
9
{
10
    /**
11
     * @var ErrorHandlerManager
12
     */
13
    protected $pluginManager;
14
15
    public function setUp()
16
    {
17
        $this->pluginManager = new ErrorHandlerManager(new ServiceManager(), [
18
            'services' => [
19
                'foo' => function () {
20
                },
21
            ],
22
            'invokables' => [
23
                'invalid' => \stdClass::class,
24
            ]
25
        ]);
26
    }
27
28
    /**
29
     * @test
30
     */
31
    public function callablesAreReturned()
32
    {
33
        $instance = $this->pluginManager->get('foo');
34
        $this->assertInstanceOf(\Closure::class, $instance);
35
    }
36
37
    /**
38
     * @test
39
     * @expectedException \Zend\ServiceManager\Exception\InvalidServiceException
40
     */
41
    public function nonCallablesThrowException()
42
    {
43
        $this->pluginManager->get('invalid');
44
    }
45
}
46