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

ConfigurationTest::test_configuration_tree_build()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 24
rs 8.9713
cc 1
eloc 16
nc 1
nop 0
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