Passed
Push — master ( 37aa33...f3b4a1 )
by Gabriel
02:09
created

ModulesManagerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_getNames() 0 6 1
A test_loadFromConfig() 0 6 1
A prepareConfig() 0 5 1
1
<?php
2
3
namespace Nip\Mvc\Tests\Modules;
4
5
use Nip\Config\Config;
6
use Nip\Container\Container;
7
use Nip\Mvc\Modules\ModulesManager;
8
use Nip\Mvc\Sections\SectionsManager;
9
use Nip\Mvc\Tests\AbstractTest;
10
11
/**
12
 * Class ModulesManagerTest
13
 * @package Nip\Mvc\Tests\Modules
14
 */
15
class ModulesManagerTest extends AbstractTest
16
{
17
    public function test_getNames()
18
    {
19
        $this->prepareConfig();
20
        $manager = new ModulesManager();
21
22
        self::assertSame(['admin', 'frontend', 'api'], $manager->getNames());
23
    }
24
25
    public function test_loadFromConfig()
26
    {
27
        $this->prepareConfig();
28
        $manager = new ModulesManager();
29
30
        self::assertCount(3, $manager->getModules());
31
    }
32
33
    /**
34
     * @param string $file
35
     */
36
    protected function prepareConfig($file = 'basic')
37
    {
38
        $data = require TEST_FIXTURE_PATH . DIRECTORY_SEPARATOR. 'config'. DIRECTORY_SEPARATOR . $file.'.php';
39
        $config = new Config(['mvc' => $data]);
40
        Container::getInstance()->set('config', $config);
41
    }
42
}