SectionsManagerTest::test_visibleIn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Nip\Mvc\Tests\Sections;
4
5
use Nip\Config\Config;
6
use Nip\Container\Container;
7
use Nip\Mvc\Sections\SectionsManager;
8
use Nip\Mvc\Tests\AbstractTest;
9
10
/**
11
 * Class SectionsManagerTest
12
 * @package Nip\Mvc\Tests\Sections
13
 */
14
class SectionsManagerTest extends AbstractTest
15
{
16
    public function test_loadFromConfig()
17
    {
18
        $this->prepareConfig();
19
        $manager = new SectionsManager();
20
21
        self::assertCount(3, $manager->getSections());
22
    }
23
24
    public function test_visibleIn()
25
    {
26
        $this->prepareConfig();
27
        $manager = new SectionsManager();
28
29
        $adminSections = $manager->visibleIn('admin');
30
        self::assertCount(2, $adminSections);
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
}
43