[Config] Extra tests for Config component
This commit is contained in:
parent
c4069a4016
commit
d0f4434c4e
@ -185,6 +185,48 @@ class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testCanBeDisabled()
|
||||
{
|
||||
$node = new ArrayNodeDefinition('root');
|
||||
$node->canBeDisabled();
|
||||
|
||||
$this->assertTrue($this->getField($node, 'addDefaults'));
|
||||
$this->assertEquals(array('enabled' => false), $this->getField($node, 'falseEquivalent'));
|
||||
$this->assertEquals(array('enabled' => true), $this->getField($node, 'trueEquivalent'));
|
||||
$this->assertEquals(array('enabled' => true), $this->getField($node, 'nullEquivalent'));
|
||||
|
||||
$nodeChildren = $this->getField($node, 'children');
|
||||
$this->assertArrayHasKey('enabled', $nodeChildren);
|
||||
|
||||
$enabledNode = $nodeChildren['enabled'];
|
||||
$this->assertTrue($this->getField($enabledNode, 'default'));
|
||||
$this->assertTrue($this->getField($enabledNode, 'defaultValue'));
|
||||
}
|
||||
|
||||
public function testIgnoreExtraKeys()
|
||||
{
|
||||
$node = new ArrayNodeDefinition('root');
|
||||
|
||||
$this->assertFalse($this->getField($node, 'ignoreExtraKeys'));
|
||||
|
||||
$result = $node->ignoreExtraKeys();
|
||||
|
||||
$this->assertEquals($node, $result);
|
||||
$this->assertTrue($this->getField($node, 'ignoreExtraKeys'));
|
||||
}
|
||||
|
||||
public function testNormalizeKeys()
|
||||
{
|
||||
$node = new ArrayNodeDefinition('root');
|
||||
|
||||
$this->assertTrue($this->getField($node, 'normalizeKeys'));
|
||||
|
||||
$result = $node->normalizeKeys(false);
|
||||
|
||||
$this->assertEquals($node, $result);
|
||||
$this->assertFalse($this->getField($node, 'normalizeKeys'));
|
||||
}
|
||||
|
||||
public function getEnableableNodeFixtures()
|
||||
{
|
||||
return array(
|
||||
|
@ -150,6 +150,26 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array(), $this->finalizeTestBuilder($test));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage You must specify an if part.
|
||||
*/
|
||||
public function testEndIfPartNotSpecified()
|
||||
{
|
||||
$this->getTestBuilder()->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage You must specify a then part.
|
||||
*/
|
||||
public function testEndThenPartNotSpecified()
|
||||
{
|
||||
$builder = $this->getTestBuilder();
|
||||
$builder->ifPart = 'test';
|
||||
$builder->end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a test treebuilder with a variable node, and init the validation.
|
||||
*
|
||||
|
Reference in New Issue
Block a user