HandlerTest::dataIsDebug()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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