| 1 | <?php |
||
| 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 |