@@ -28,7 +28,7 @@ class DumperTest extends TestCase
2828 '' => 'bar ' ,
2929 'foo ' => '#bar ' ,
3030 'foo \'bar ' => [],
31- 'bar ' => [1 , 'foo ' ],
31+ 'bar ' => [1 , 'foo ' , [ ' a ' => ' A ' ] ],
3232 'foobar ' => [
3333 'foo ' => 'bar ' ,
3434 'bar ' => [1 , 'foo ' ],
@@ -64,6 +64,8 @@ public function testIndentationInConstructor()
6464bar:
6565 - 1
6666 - foo
67+ -
68+ a: A
6769foobar:
6870 foo: bar
6971 bar:
@@ -107,7 +109,7 @@ public function testSpecifications()
107109 public function testInlineLevel ()
108110 {
109111 $ expected = <<<'EOF'
110- { '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
112+ { '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo, { a: A } ], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
111113EOF;
112114 $ this ->assertEquals ($ expected , $ this ->dumper ->dump ($ this ->array , -10 ), '->dump() takes an inline level argument ' );
113115 $ this ->assertEquals ($ expected , $ this ->dumper ->dump ($ this ->array , 0 ), '->dump() takes an inline level argument ' );
@@ -116,7 +118,7 @@ public function testInlineLevel()
116118'': bar
117119foo: '#bar'
118120'foo''bar': { }
119- bar: [1, foo]
121+ bar: [1, foo, { a: A } ]
120122foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } }
121123
122124EOF;
@@ -129,6 +131,7 @@ public function testInlineLevel()
129131bar:
130132 - 1
131133 - foo
134+ - { a: A }
132135foobar:
133136 foo: bar
134137 bar: [1, foo]
@@ -144,6 +147,8 @@ public function testInlineLevel()
144147bar:
145148 - 1
146149 - foo
150+ -
151+ a: A
147152foobar:
148153 foo: bar
149154 bar:
@@ -163,6 +168,8 @@ public function testInlineLevel()
163168bar:
164169 - 1
165170 - foo
171+ -
172+ a: A
166173foobar:
167174 foo: bar
168175 bar:
@@ -379,8 +386,9 @@ public function testDumpingTaggedValueSequenceRespectsInlineLevel()
379386 new TaggedValue ('user ' , [
380387 'username ' => 'jane ' ,
381388 ]),
382- new TaggedValue ('user ' , [
383- 'username ' => 'john ' ,
389+ new TaggedValue ('names ' , [
390+ 'john ' ,
391+ 'claire ' ,
384392 ]),
385393 ];
386394
@@ -389,8 +397,9 @@ public function testDumpingTaggedValueSequenceRespectsInlineLevel()
389397 $ expected = <<<YAML
390398- !user
391399 username: jane
392- - !user
393- username: john
400+ - !names
401+ - john
402+ - claire
394403
395404YAML ;
396405 $ this ->assertSame ($ expected , $ yaml );
@@ -402,16 +411,17 @@ public function testDumpingTaggedValueSequenceWithInlinedTagValues()
402411 new TaggedValue ('user ' , [
403412 'username ' => 'jane ' ,
404413 ]),
405- new TaggedValue ('user ' , [
406- 'username ' => 'john ' ,
414+ new TaggedValue ('names ' , [
415+ 'john ' ,
416+ 'claire ' ,
407417 ]),
408418 ];
409419
410420 $ yaml = $ this ->dumper ->dump ($ data , 1 );
411421
412422 $ expected = <<<YAML
413423- !user { username: jane }
414- - !user { username: john }
424+ - !names [ john, claire]
415425
416426YAML ;
417427 $ this ->assertSame ($ expected , $ yaml );
@@ -423,8 +433,9 @@ public function testDumpingTaggedValueMapRespectsInlineLevel()
423433 'user1 ' => new TaggedValue ('user ' , [
424434 'username ' => 'jane ' ,
425435 ]),
426- 'user2 ' => new TaggedValue ('user ' , [
427- 'username ' => 'john ' ,
436+ 'names1 ' => new TaggedValue ('names ' , [
437+ 'john ' ,
438+ 'claire ' ,
428439 ]),
429440 ];
430441
@@ -433,8 +444,9 @@ public function testDumpingTaggedValueMapRespectsInlineLevel()
433444 $ expected = <<<YAML
434445user1: !user
435446 username: jane
436- user2: !user
437- username: john
447+ names1: !names
448+ - john
449+ - claire
438450
439451YAML ;
440452 $ this ->assertSame ($ expected , $ yaml );
@@ -446,16 +458,17 @@ public function testDumpingTaggedValueMapWithInlinedTagValues()
446458 'user1 ' => new TaggedValue ('user ' , [
447459 'username ' => 'jane ' ,
448460 ]),
449- 'user2 ' => new TaggedValue ('user ' , [
450- 'username ' => 'john ' ,
461+ 'names1 ' => new TaggedValue ('names ' , [
462+ 'john ' ,
463+ 'claire ' ,
451464 ]),
452465 ];
453466
454467 $ yaml = $ this ->dumper ->dump ($ data , 1 );
455468
456469 $ expected = <<<YAML
457470user1: !user { username: jane }
458- user2 : !user { username: john }
471+ names1 : !names [ john, claire]
459472
460473YAML ;
461474 $ this ->assertSame ($ expected , $ yaml );
0 commit comments