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

Skip to content

Commit c8c50cf

Browse files
committed
Test case for not in-lined map-objects
1 parent 96e7ded commit c8c50cf

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
@@ -205,6 +205,25 @@ public function testInlineLevel()
205205
$this->assertEquals($expected, $this->dumper->dump($this->array, 10), '->dump() takes an inline level argument');
206206
}
207207

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

0 commit comments

Comments
 (0)
0