Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4f5c149

Browse filesBrowse files
goetasxabbuh
authored andcommitted
Test case for not in-lined map-objects
1 parent e71807b commit 4f5c149
Copy full SHA for 4f5c149

File tree

1 file changed

+19
-0
lines changed
Filter options

1 file changed

+19
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/DumperTest.php
+19Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.