Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/yaml
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.4.37
Choose a base ref
...
head repository: symfony/yaml
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.4.43
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jun 20, 2022

  1. Copy the full SHA
    07e392f View commit details
Showing with 30 additions and 17 deletions.
  1. +30 −17 Tests/DumperTest.php
47 changes: 30 additions & 17 deletions Tests/DumperTest.php
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ class DumperTest extends TestCase
'' => 'bar',
'foo' => '#bar',
'foo\'bar' => [],
'bar' => [1, 'foo'],
'bar' => [1, 'foo', ['a' => 'A']],
'foobar' => [
'foo' => 'bar',
'bar' => [1, 'foo'],
@@ -64,6 +64,8 @@ public function testIndentationInConstructor()
bar:
- 1
- foo
-
a: A
foobar:
foo: bar
bar:
@@ -107,7 +109,7 @@ public function testSpecifications()
public function testInlineLevel()
{
$expected = <<<'EOF'
{ '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
{ '': bar, foo: '#bar', 'foo''bar': { }, bar: [1, foo, { a: A }], foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } } }
EOF;
$this->assertEquals($expected, $this->dumper->dump($this->array, -10), '->dump() takes an inline level argument');
$this->assertEquals($expected, $this->dumper->dump($this->array, 0), '->dump() takes an inline level argument');
@@ -116,7 +118,7 @@ public function testInlineLevel()
'': bar
foo: '#bar'
'foo''bar': { }
bar: [1, foo]
bar: [1, foo, { a: A }]
foobar: { foo: bar, bar: [1, foo], foobar: { foo: bar, bar: [1, foo] } }

EOF;
@@ -129,6 +131,7 @@ public function testInlineLevel()
bar:
- 1
- foo
- { a: A }
foobar:
foo: bar
bar: [1, foo]
@@ -144,6 +147,8 @@ public function testInlineLevel()
bar:
- 1
- foo
-
a: A
foobar:
foo: bar
bar:
@@ -163,6 +168,8 @@ public function testInlineLevel()
bar:
- 1
- foo
-
a: A
foobar:
foo: bar
bar:
@@ -379,8 +386,9 @@ public function testDumpingTaggedValueSequenceRespectsInlineLevel()
new TaggedValue('user', [
'username' => 'jane',
]),
new TaggedValue('user', [
'username' => 'john',
new TaggedValue('names', [
'john',
'claire',
]),
];

@@ -389,8 +397,9 @@ public function testDumpingTaggedValueSequenceRespectsInlineLevel()
$expected = <<<YAML
- !user
username: jane
- !user
username: john
- !names
- john
- claire
YAML;
$this->assertSame($expected, $yaml);
@@ -402,16 +411,17 @@ public function testDumpingTaggedValueSequenceWithInlinedTagValues()
new TaggedValue('user', [
'username' => 'jane',
]),
new TaggedValue('user', [
'username' => 'john',
new TaggedValue('names', [
'john',
'claire',
]),
];

$yaml = $this->dumper->dump($data, 1);

$expected = <<<YAML
- !user { username: jane }
- !user { username: john }
- !names [john, claire]
YAML;
$this->assertSame($expected, $yaml);
@@ -423,8 +433,9 @@ public function testDumpingTaggedValueMapRespectsInlineLevel()
'user1' => new TaggedValue('user', [
'username' => 'jane',
]),
'user2' => new TaggedValue('user', [
'username' => 'john',
'names1' => new TaggedValue('names', [
'john',
'claire',
]),
];

@@ -433,8 +444,9 @@ public function testDumpingTaggedValueMapRespectsInlineLevel()
$expected = <<<YAML
user1: !user
username: jane
user2: !user
username: john
names1: !names
- john
- claire
YAML;
$this->assertSame($expected, $yaml);
@@ -446,16 +458,17 @@ public function testDumpingTaggedValueMapWithInlinedTagValues()
'user1' => new TaggedValue('user', [
'username' => 'jane',
]),
'user2' => new TaggedValue('user', [
'username' => 'john',
'names1' => new TaggedValue('names', [
'john',
'claire',
]),
];

$yaml = $this->dumper->dump($data, 1);

$expected = <<<YAML
user1: !user { username: jane }
user2: !user { username: john }
names1: !names [john, claire]
YAML;
$this->assertSame($expected, $yaml);