|
@@ -15,9 +15,7 @@ class MergeTest extends \PHPUnit_Framework_TestCase
|
|
$tree = $tb
|
|
$tree = $tb
|
|
->root('root', 'array')
|
|
->root('root', 'array')
|
|
->node('foo', 'scalar')
|
|
->node('foo', 'scalar')
|
|
- ->merge()
|
|
|
|
- ->denyOverwrite()
|
|
|
|
- ->end()
|
|
|
|
|
|
+ ->cannotBeOverwritten()
|
|
->end()
|
|
->end()
|
|
->end()
|
|
->end()
|
|
->buildTree()
|
|
->buildTree()
|
|
@@ -42,12 +40,12 @@ class MergeTest extends \PHPUnit_Framework_TestCase
|
|
->node('foo', 'scalar')->end()
|
|
->node('foo', 'scalar')->end()
|
|
->node('bar', 'scalar')->end()
|
|
->node('bar', 'scalar')->end()
|
|
->node('unsettable', 'array')
|
|
->node('unsettable', 'array')
|
|
- ->merge()->allowUnset()->end()
|
|
|
|
|
|
+ ->canBeUnset()
|
|
->node('foo', 'scalar')->end()
|
|
->node('foo', 'scalar')->end()
|
|
->node('bar', 'scalar')->end()
|
|
->node('bar', 'scalar')->end()
|
|
->end()
|
|
->end()
|
|
->node('unsetted', 'array')
|
|
->node('unsetted', 'array')
|
|
- ->merge()->allowUnset()->end()
|
|
|
|
|
|
+ ->canBeUnset()
|
|
->prototype('scalar')->end()
|
|
->prototype('scalar')->end()
|
|
->end()
|
|
->end()
|
|
->end()
|
|
->end()
|
|
@@ -145,4 +143,28 @@ class MergeTest extends \PHPUnit_Framework_TestCase
|
|
)
|
|
)
|
|
), $tree->merge($a, $b));
|
|
), $tree->merge($a, $b));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function testPrototypeWithoutAKeyAttribute()
|
|
|
|
+ {
|
|
|
|
+ $tb = new TreeBuilder();
|
|
|
|
+
|
|
|
|
+ $tree = $tb
|
|
|
|
+ ->root('config', 'array')
|
|
|
|
+ ->node('append_elements', 'array')
|
|
|
|
+ ->prototype('scalar')->end()
|
|
|
|
+ ->end()
|
|
|
|
+ ->end()
|
|
|
|
+ ->buildTree()
|
|
|
|
+ ;
|
|
|
|
+
|
|
|
|
+ $a = array(
|
|
|
|
+ 'append_elements' => array('a', 'b'),
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $b = array(
|
|
|
|
+ 'append_elements' => array('c', 'd'),
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $this->assertEquals(array('append_elements' => array('a', 'b', 'c', 'd')), $tree->merge($a, $b));
|
|
|
|
+ }
|
|
}
|
|
}
|