minor #16074 [Yaml] Add regression test for comments indents (ogizanagi)

This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] Add regression test for comments indents

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This is related to #16065, #15857 and #15860  (last one has been reverted due to this regression)

Commits
-------

7b9d519 [Yaml] Add regression test for comments indents
This commit is contained in:
Fabien Potencier 2015-10-02 14:33:33 +02:00
commit 351bccbffb
1 changed files with 26 additions and 0 deletions

View File

@ -560,6 +560,32 @@ EOF;
$this->assertEquals(array('hash' => null), Yaml::parse($input));
}
public function testCommentAtTheRootIndent()
{
$this->assertEquals(array(
'services' => array(
'app.foo_service' => array(
'class' => 'Foo',
),
'app/bar_service' => array(
'class' => 'Bar',
),
),
), Yaml::parse(<<<EOF
# comment 1
services:
# comment 2
# comment 3
app.foo_service:
class: Foo
# comment 4
# comment 5
app/bar_service:
class: Bar
EOF
));
}
public function testStringBlockWithComments()
{
$this->assertEquals(array('content' => <<<EOT