ConfigTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 30
rs 10
c 1
b 0
f 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testConfig() 0 8 1
A testLayeredConfig() 0 9 1
A testNestedGet() 0 6 1
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