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

ModulesManagerTest::test_loadFromConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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