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 c8c50cf

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

File tree

Expand file treeCollapse file tree

1 file changed

+19
-0
lines changed
Filter options
Expand file treeCollapse file tree

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
@@ -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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.