Completed
Push — master ( cb575d...8e212c )
by Alessandro
02:01
created

ConfigurationTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 5
dl 0
loc 29
rs 10
1
<?php
2
declare(strict_types=1);
3
namespace Algatux\InfluxDbBundle\Tests\unit;
4
5
use Algatux\InfluxDbBundle\DependencyInjection\Configuration;
6
use Symfony\Component\Config\Definition\ArrayNode;
7
use Symfony\Component\Config\Definition\Processor;
8
9
class ConfigurationTest extends \PHPUnit_Framework_TestCase
10
{
11
12
    public function test_configuration_tree_build()
13
    {
14
        $conf = new Configuration();
15
        $tree = $conf->getConfigTreeBuilder();
16
17
        $builtConf = $tree->buildTree();
18
19
        $this->assertInstanceOf(ArrayNode::class, $builtConf);
20
        $this->assertEquals('influx_db',$builtConf->getName());
21
22
        $processor = new Processor();
23
24
        $conf = $processor->process($builtConf, []);
25
26
        $this->assertArrayHasKey('host', $conf);
27
        $this->assertArrayHasKey('udp_port', $conf);
28
        $this->assertArrayHasKey('http_port', $conf);
29
        $this->assertArrayHasKey('database', $conf);
30
31
        $this->assertEquals('localhost',$conf['host']);
32
        $this->assertEquals('4444',$conf['udp_port']);
33
        $this->assertEquals('8086',$conf['http_port']);
34
        $this->assertEquals('udp',$conf['database']);
35
    }
36
    
37
}
38