You are here

public function ParserTest::testMappingDuplicateKeyBlock in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::testMappingDuplicateKeyBlock()

> It is an error for two equal keys to appear in the same mapping node. > In such a case the YAML processor may continue, ignoring the second > `key: value` pair and issuing an appropriate warning. This strategy > preserves a consistent information model for one-pass and random access > applications.

@covers \Symfony\Component\Yaml\Parser::parse

See also

http://yaml.org/spec/1.2/spec.html#id2759572

http://yaml.org/spec/1.1/#id932806

File

vendor/symfony/yaml/Tests/ParserTest.php, line 581

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testMappingDuplicateKeyBlock() {
  $input = <<<EOD
parent:
    child: first
    child: duplicate
parent:
    child: duplicate
    child: duplicate
EOD;
  $expected = array(
    'parent' => array(
      'child' => 'first',
    ),
  );
  $this
    ->assertSame($expected, Yaml::parse($input));
}