Completed
Pull Request — master (#8)
by VEBER
02:15
created

KernelTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstruct() 0 10 1
A testRegisterBundles() 0 11 1
A constructProvider() 0 11 1
1
<?php
2
3
/**
4
 * This file is part of the CLIFramework package.
5
 *
6
 * (c) Arnaud VEBER <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CLIFramework;
13
14
use CLIFramework\Kernel;
15
16
class KernelTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * test construct.
20
     *
21
     * @param string $environment
22
     * @param bool $debug
23
     *
24
     * @dataProvider constructProvider
25
     */
26
    public function testConstruct($environment, $debug)
27
    {
28
        // create kernel
29
        $kernel = new Kernel($environment, $debug);
30
31
        // assert
32
        $this->assertInstanceOf('\CLIFramework\Kernel', $kernel);
33
        $this->assertEquals($environment, $kernel->getEnvironment());
34
        $this->assertEquals($debug, $kernel->isDebug());
35
    }
36
37
    /**
38
     * test register bundles
39
     */
40
    public function testRegisterBundles()
41
    {
42
        // create kernel
43
        $kernel = new Kernel('test', true);
44
45
        // register bundles
46
        $bundles = $kernel->registerBundles();
47
48
        // assert
49
        $this->assertInstanceOf('\Symfony\Bundle\MonologBundle\MonologBundle', $bundles[0]);
50
    }
51
52
    /**
53
     * construct provider.
54
     *
55
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<string|boolean>[].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
56
     */
57
    public function constructProvider()
58
    {
59
        return array(
60
            array('test', true),
61
            array('test', false),
62
            array('dev', true),
63
            array('dev', false),
64
            array('prod', true),
65
            array('prod', false),
66
        );
67
    }
68
}
69