* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Symfony\Tests\Component\Config\Definition\Builder; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase { public function testAppendingSomeNode() { $parent = new ArrayNodeDefinition('root'); $child = new ScalarNodeDefinition('child'); $node = $parent ->children() ->scalarNode('foo')->end() ->scalarNode('bar')->end() ->end() ->append($child); $this->assertEquals(count($this->getField($parent, 'children')), 3); $this->assertTrue(in_array($child, $this->getField($parent, 'children'))); } protected function getField($object, $field) { $reflection = new \ReflectionProperty($object, $field); $reflection->setAccessible(true); return $reflection->getValue($object); } }