ModuleTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testGetConfig() 0 17 1
A testGetAutoloaderConfig() 0 17 1
1
<?php
2
3
/**
4
 * AistInsight (http://mateuszsitek.com/projects/aist-insight)
5
 *
6
 * @link      http://github.com/ma-si/aist-insight for the canonical source repository
7
 * @copyright Copyright (c) 2006-2016 Aist Internet Technologies (http://aist.pl) All rights reserved.
8
 * @license   http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
9
 */
10
11
namespace AistInsightTest;
12
13
use AistInsight\Module;
14
use PHPUnit_Framework_TestCase;
15
16
class ModuleTest extends PHPUnit_Framework_TestCase
17
{
18
    /** @var Module */
19
    private $module;
20
21
    /**
22
     * __NAMESPACE__ of module
23
     *
24
     * @var string
25
     */
26
    private $namespace;
27
28
    public function setUp()
29
    {
30
        $this->module = new Module();
31
        $this->namespace = 'AistInsight';
32
    }
33
34
    public function testGetConfig()
35
    {
36
        $config = $this->module->getConfig();
37
38
        $expectedConfig = [
39
            'view_helpers' => [
40
                'invokables' => [
41
                    'insight' => $this->namespace . '\View\Helper\Insight',
42
                ],
43
            ],
44
        ];
45
46
        $this->assertInternalType('array', $config);
47
        $this->assertArrayHasKey('view_helpers', $config);
48
        $this->assertSame($expectedConfig, $config);
49
        $this->assertSame($config, unserialize(serialize($config)));
50
    }
51
52
    public function testGetAutoloaderConfig()
53
    {
54
        $config = $this->module->getAutoloaderConfig();
55
56
        $expectedAutoloaderConfig = [
57
            'Zend\Loader\ClassMapAutoloader' => [
58
                realpath(__DIR__ . '/../..') . '/autoload_classmap.php',
59
            ],
60
            'Zend\Loader\StandardAutoloader' => [
61
                'namespaces' => [
62
                    $this->namespace => realpath(__DIR__ . '/../..') . '/src/' . $this->namespace,
63
                ],
64
            ],
65
        ];
66
67
        $this->assertSame($expectedAutoloaderConfig, $config);
68
    }
69
}
70