public function ParserTest::getCommentLikeStringInScalarBlockData in Lockr 7.3
File
- vendor/
symfony/ yaml/ Tests/ ParserTest.php, line 1276
Class
Namespace
Symfony\Component\Yaml\TestsCode
public function getCommentLikeStringInScalarBlockData() {
$tests = [];
$yaml = <<<'EOT'
pages:
-
title: some title
content: |
# comment 1
header
# comment 2
<body>
<h1>title</h1>
</body>
footer # comment3
EOT;
$expected = [
'pages' => [
[
'title' => 'some title',
'content' => <<<'EOT'
# comment 1
header
# comment 2
<body>
<h1>title</h1>
</body>
footer # comment3
EOT
,
],
],
];
$tests[] = [
$yaml,
$expected,
];
$yaml = <<<'EOT'
test: |
foo
# bar
baz
collection:
- one: |
foo
# bar
baz
- two: |
foo
# bar
baz
EOT;
$expected = [
'test' => <<<'EOT'
foo
# bar
baz
EOT
,
'collection' => [
[
'one' => <<<'EOT'
foo
# bar
baz
EOT
,
],
[
'two' => <<<'EOT'
foo
# bar
baz
EOT
,
],
],
];
$tests[] = [
$yaml,
$expected,
];
$yaml = <<<'EOT'
foo:
bar:
scalar-block: >
line1
line2>
baz:
# comment
foobar: ~
EOT;
$expected = [
'foo' => [
'bar' => [
'scalar-block' => "line1 line2>\n",
],
'baz' => [
'foobar' => null,
],
],
];
$tests[] = [
$yaml,
$expected,
];
$yaml = <<<'EOT'
a:
b: hello
# c: |
# first row
# second row
d: hello
EOT;
$expected = [
'a' => [
'b' => 'hello',
'd' => 'hello',
],
];
$tests[] = [
$yaml,
$expected,
];
return $tests;
}