|
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
|
|
|
|