@@ -18,11 +18,7 @@ class PartialNodeTest extends TestCase
18
18
public function it_strips_children_that_are_not_in_the_given_path_with_one_name ()
19
19
{
20
20
$ treeBuilder = new TreeBuilder ('root ' );
21
- if (method_exists ($ treeBuilder , 'getRootNode ' )) {
22
- $ root = $ treeBuilder ->getRootNode ();
23
- } else {
24
- $ root = $ treeBuilder ->root ('root ' );
25
- }
21
+ $ root = $ treeBuilder ->getRootNode ();
26
22
$ root
27
23
->children ()
28
24
->arrayNode ('node_1 ' )
@@ -49,11 +45,7 @@ public function it_strips_children_that_are_not_in_the_given_path_with_one_name(
49
45
public function it_strips_children_that_are_not_in_the_given_path_with_several_names ()
50
46
{
51
47
$ treeBuilder = new TreeBuilder ('root ' );
52
- if (method_exists ($ treeBuilder , 'getRootNode ' )) {
53
- $ root = $ treeBuilder ->getRootNode ();
54
- } else {
55
- $ root = $ treeBuilder ->root ('root ' );
56
- }
48
+ $ root = $ treeBuilder ->getRootNode ();
57
49
$ root
58
50
->children ()
59
51
->arrayNode ('node_1 ' )
@@ -91,11 +83,7 @@ public function it_strips_children_that_are_not_in_the_given_path_with_several_n
91
83
public function it_strips_children_when_leaf_node_is_not_an_array ()
92
84
{
93
85
$ treeBuilder = new TreeBuilder ('root ' );
94
- if (method_exists ($ treeBuilder , 'getRootNode ' )) {
95
- $ root = $ treeBuilder ->getRootNode ();
96
- } else {
97
- $ root = $ treeBuilder ->root ('root ' );
98
- }
86
+ $ root = $ treeBuilder ->getRootNode ();
99
87
$ root
100
88
->children ()
101
89
->arrayNode ('node_1 ' )
@@ -122,11 +110,7 @@ public function it_strips_children_when_leaf_node_is_not_an_array()
122
110
public function it_does_not_crash_on_prototypes ()
123
111
{
124
112
$ treeBuilder = new TreeBuilder ('root ' );
125
- if (method_exists ($ treeBuilder , 'getRootNode ' )) {
126
- $ root = $ treeBuilder ->getRootNode ();
127
- } else {
128
- $ root = $ treeBuilder ->root ('root ' );
129
- }
113
+ $ root = $ treeBuilder ->getRootNode ();
130
114
$ root
131
115
->prototype ('array ' )
132
116
->children ()
@@ -156,11 +140,7 @@ public function it_does_not_crash_on_prototypes()
156
140
public function it_fails_when_a_requested_child_node_does_not_exist ()
157
141
{
158
142
$ treeBuilder = new TreeBuilder ('root ' );
159
- if (method_exists ($ treeBuilder , 'getRootNode ' )) {
160
- $ root = $ treeBuilder ->getRootNode ();
161
- } else {
162
- $ root = $ treeBuilder ->root ('root ' );
163
- }
143
+ $ root = $ treeBuilder ->getRootNode ();
164
144
$ root
165
145
->children ()
166
146
->arrayNode ('sub_node ' )
@@ -181,11 +161,7 @@ public function it_fails_when_a_requested_child_node_does_not_exist()
181
161
public function it_fails_when_a_requested_child_node_is_no_array_node_itself_and_path_not_empty ()
182
162
{
183
163
$ treeBuilder = new TreeBuilder ('root ' );
184
- if (method_exists ($ treeBuilder , 'getRootNode ' )) {
185
- $ root = $ treeBuilder ->getRootNode ();
186
- } else {
187
- $ root = $ treeBuilder ->root ('root ' );
188
- }
164
+ $ root = $ treeBuilder ->getRootNode ();
189
165
$ root
190
166
->children ()
191
167
->arrayNode ('sub_node ' )
@@ -203,7 +179,6 @@ public function it_fails_when_a_requested_child_node_is_no_array_node_itself_and
203
179
private function nodeOnlyHasChild (ArrayNode $ node , $ nodeName )
204
180
{
205
181
$ property = new \ReflectionProperty ($ node , 'children ' );
206
- $ property ->setAccessible (true );
207
182
$ children = $ property ->getValue ($ node );
208
183
209
184
$ this ->assertCount (1 , $ children );
0 commit comments