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