You are here

public function DumperTest::testDumpingStdClassInstancesRespectsInlineLevel in Lockr 7.3

File

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

Class

DumperTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testDumpingStdClassInstancesRespectsInlineLevel() {
  $deep = new \stdClass();
  $deep->deep1 = 'd';
  $deep->deep2 = 'e';
  $inner = new \stdClass();
  $inner->inner1 = 'b';
  $inner->inner2 = 'c';
  $inner->inner3 = $deep;
  $outer = new \stdClass();
  $outer->outer1 = 'a';
  $outer->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);
}