[Config] Improved test
This commit is contained in:
parent
bdfc2aa652
commit
456d53acc9
@ -161,4 +161,41 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Child nodes must be named.
|
||||
*/
|
||||
public function testAddChildEmptyName()
|
||||
{
|
||||
$node = new ArrayNode('root');
|
||||
|
||||
$childNode = new ArrayNode('');
|
||||
$node->addChild($childNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage A child node named "foo" already exists.
|
||||
*/
|
||||
public function testAddChildNameAlreadyExists()
|
||||
{
|
||||
$node = new ArrayNode('root');
|
||||
|
||||
$childNode = new ArrayNode('foo');
|
||||
$node->addChild($childNode);
|
||||
|
||||
$childNodeWithSameName = new ArrayNode('foo');
|
||||
$node->addChild($childNodeWithSameName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage The node at path "foo" has no default value.
|
||||
*/
|
||||
public function testGetDefaultValueWithoutDefaultValue()
|
||||
{
|
||||
$node = new ArrayNode('foo');
|
||||
$node->getDefaultValue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user