You are here

public function DumperTest::testDumpingArrayObjectInstancesRespectsInlineLevel in Lockr 7.3

File

vendor/symfony/yaml/Tests/DumperTest.php, line 354

Class

DumperTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testDumpingArrayObjectInstancesRespectsInlineLevel() {
  $deep = new \ArrayObject([
    'deep1' => 'd',
    'deep2' => 'e',
  ]);
  $inner = new \ArrayObject([
    'inner1' => 'b',
    'inner2' => 'c',
    'inner3' => $deep,
  ]);
  $outer = new \ArrayObject([
    'outer1' => 'a',
    'outer2' => $inner,
  ]);
  $yaml = $this->dumper
    ->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP);
  $expected = <<<YAML
outer1: a
outer2:
    inner1: b
    inner2: c
    inner3: { deep1: d, deep2: e }

YAML;
  $this
    ->assertSame($expected, $yaml);
}