8000 [Config] Extra tests for Config component by zomberg · Pull Request #19399 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Config] Extra tests for Config component #19399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Config] Added extra tests for ArrayNodeDefinition class
  • Loading branch information
zomberg committed Jul 25, 2016
commit 98035d05ed175f94e5d1810e7b65116be8654b70
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,49 @@ public function testTrueEnableEnabledNode($expected, $config, $message)
);
}

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'));
$this->assertEquals(array('enabled' => true), $this->getField($node, 'nullEquivalent'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


$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(
Expand Down
0