Skip to content

Commit 51bba5f

Browse files
committed
[Config] Improved test
1 parent 5781b5c commit 51bba5f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Tests/Definition/ArrayNodeTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,41 @@ public function getPreNormalizedNormalizedOrderedData()
161161
),
162162
);
163163
}
164+
165+
/**
166+
* @expectedException \InvalidArgumentException
167+
* @expectedExceptionMessage Child nodes must be named.
168+
*/
169+
public function testAddChildEmptyName()
170+
{
171+
$node = new ArrayNode('root');
172+
173+
$childNode = new ArrayNode('');
174+
$node->addChild($childNode);
175+
}
176+
177+
/**
178+
* @expectedException \InvalidArgumentException
179+
* @expectedExceptionMessage A child node named "foo" already exists.
180+
*/
181+
public function testAddChildNameAlreadyExists()
182+
{
183+
$node = new ArrayNode('root');
184+
185+
$childNode = new ArrayNode('foo');
186+
$node->addChild($childNode);
187+
188+
$childNodeWithSameName = new ArrayNode('foo');
189+
$node->addChild($childNodeWithSameName);
190+
}
191+
192+
/**
193+
* @expectedException \RuntimeException
194+
* @expectedExceptionMessage The node at path "foo" has no default value.
195+
*/
196+
public function testGetDefaultValueWithoutDefaultValue()
197+
{
198+
$node = new ArrayNode('foo');
199+
$node->getDefaultValue();
200+
}
164201
}

0 commit comments

Comments
 (0)