8000 Test case for not in-lined map-objects · symfony/symfony@864d54f · GitHub
[go: up one dir, main page]

Skip to content

Commit 864d54f

Browse files
committed
Test case for not in-lined map-objects
1 parent 9fdd36f commit 864d54f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Symfony/Component/Yaml/Tests/DumperTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,25 @@ public function testInlineLevel()
206206
$this->assertEquals($expected, $this->dumper->dump($this->array, 10), '->dump() takes an inline level argument');
207207
}
208208

209+
public function testArrayObjectAsMapNotInLined()
210+
{
211+
$deep = new \ArrayObject(array('deep1' => 'd', 'deep2' => 'e'));
212+
$inner = new \ArrayObject(array('inner1' => 'b', 'inner2' => 'c', 'inner3' => $deep));
213+
$outer = new \ArrayObject(array('outer1' => 'a', 'outer1' => $inner));
214+
215+
$yaml = $this->dumper->dump($outer, 2, 0, Yaml::DUMP_OBJECT_AS_MAP);
216+
217+
$expected = <<<YAML
218+
outer1: a
219+
outer2:
220+
inner1: b
221+
inner2: c
222+
inner3: { deep1: d, deep2: e }
223+
224+
YAML;
225+
$this->assertEquals($expected, $yaml);
226+
}
227+
209228
public function testObjectSupportEnabled()
210229
{
211230
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_OBJECT);

0 commit comments

Comments
 (0)
0