public function ParserTest::getDataFormSpecifications in Translation template extractor 7.3
Same name and namespace in other branches
- 6.3 vendor/Symfony/Component/Yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::getDataFormSpecifications()
- 7.2 vendor/Symfony/Component/Yaml/Tests/ParserTest.php \Symfony\Component\Yaml\Tests\ParserTest::getDataFormSpecifications()
File
- vendor/
Symfony/ Component/ Yaml/ Tests/ ParserTest.php, line 45
Class
Namespace
Symfony\Component\Yaml\TestsCode
public function getDataFormSpecifications() {
$parser = new Parser();
$path = __DIR__ . '/Fixtures';
$tests = array();
$files = $parser
->parse(file_get_contents($path . '/index.yml'));
foreach ($files as $file) {
$yamls = file_get_contents($path . '/' . $file . '.yml');
// split YAMLs documents
foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) {
if (!$yaml) {
continue;
}
$test = $parser
->parse($yaml);
if (isset($test['todo']) && $test['todo']) {
// TODO
}
else {
$expected = var_export(eval('return ' . trim($test['php']) . ';'), true);
$tests[] = array(
$file,
$expected,
$test['yaml'],
$test['test'],
);
}
}
}
return $tests;
}