You are here

public function ParserTest::testMergeKeysWhenMappingsAreParsedAsObjects in Lockr 7.3

File

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

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testMergeKeysWhenMappingsAreParsedAsObjects() {
  $yaml = <<<YAML
foo: &FOO
    bar: 1
bar: &BAR
    baz: 2
    <<: *FOO
baz:
    baz_foo: 3
    <<:
        baz_bar: 4
foobar:
    bar: ~
    <<: [*FOO, *BAR]
YAML;
  $expected = (object) [
    'foo' => (object) [
      'bar' => 1,
    ],
    'bar' => (object) [
      'baz' => 2,
      'bar' => 1,
    ],
    'baz' => (object) [
      'baz_foo' => 3,
      'baz_bar' => 4,
    ],
    'foobar' => (object) [
      'bar' => null,
      'baz' => 2,
    ],
  ];
  $this
    ->assertEquals($expected, $this->parser
    ->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
}