Completed
Push — master ( db6a70...69e74e )
by Ryan
03:58
created

ConfigTest::testNestedGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
namespace Opine\Config;
3
4
use PHPUnit_Framework_TestCase;
5
use Opine\Config\Service as Config;
6
7
class ConfigTest extends PHPUnit_Framework_TestCase
8
{
9
    const ROOT = __DIR__.'/../public';
10
11
    public function testConfig()
12
    {
13
        $config = new Config(self::ROOT);
14
        $this->assertTrue($config->cacheSet());
15
        $config = $config->get('db');
16
        $this->assertTrue(is_array($config));
17
        $this->assertTrue('a' === $config['dsn']);
18
    }
19
20
    public function testLayeredConfig()
21
    {
22
        putenv('OPINE_ENV=dev');
23
        $config = new Config(self::ROOT);
24
        $this->assertTrue($config->cacheSet());
25
        $config = $config->get('db');
26
        $this->assertTrue(is_array($config));
27
        $this->assertTrue('q' === $config['dsn']);
28
    }
29
30
    public function testNestedGet() {
31
        $config = new Config(self::ROOT);
32
        $this->assertTrue($config->cacheSet());
33
        $dsn = $config->get('db.dsn');
34
        $this->assertTrue('q' === $dsn);
35
    }
36
}
37