HandlerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 31
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsDebug() 0 11 1
A dataIsDebug() 0 10 1
1
<?php
2
3
namespace Nip\Http\Tests\Exceptions;
4
5
use Nip\Config\Config;
6
use Nip\Container\Container;
7
use Nip\Http\Tests\AbstractTest;
8
use Nip\Http\Exceptions\Handler;
9
10
/**
11
 * Class HandlerTest
12
 * @package Nip\Http\Tests\Exceptions
13
 */
14
class HandlerTest extends AbstractTest
15
{
16
    /**
17
     * @dataProvider dataIsDebug
18
     */
19
    public function testIsDebug($value, $debug)
20
    {
21
        $container = new Container();
22
        Container::setInstance($container);
23
        \Nip\Container\Utility\Container::container(true);
24
25
        $config = new Config(['app' => ['debug' => $value]]);
26
        $container->set('config', $config);
27
28
        $handler = new Handler($container);
29
        self::assertSame($debug, $handler->isDebug());
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    public function dataIsDebug()
36
    {
37
        return [
38
            ['', false],
39
            ['false', false],
40
            [false, false],
41
            [0, false],
42
            [1, true],
43
            ['true', true],
44
            [true, true],
45
        ];
46
    }
47
}
48
49