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

ErrorHandlerManagerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
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