minor #19476 [Config] Improved test (zomberg)
This PR was merged into the 2.7 branch.
Discussion
----------
[Config] Improved test
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Commits
-------
456d53a
[Config] Improved test
This commit is contained in:
commit
cb6c925798
@ -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