[Yaml] Fix error handling in parser

This commit is contained in:
Robin Chalas 2017-03-22 10:36:03 +01:00
parent 3495b35e4f
commit 71cec8203f
2 changed files with 16 additions and 1 deletions

View File

@ -341,7 +341,7 @@ class Parser
try {
$parsedLine = Inline::parse($line, $flags, $this->refs);
if (!is_string($value)) {
if (!is_string($parsedLine)) {
$parseError = true;
break;
}

View File

@ -1687,6 +1687,21 @@ YAML;
$this->parser->parse($yaml);
}
/**
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage Unable to parse at line 1 (near "[parameters]").
*/
public function testParsingIniThrowsException()
{
$ini = <<<INI
[parameters]
foo = bar
bar = %foo%
INI;
$this->parser->parse($ini);
}
private function loadTestsFromFixtureFiles($testsFile)
{
$parser = new Parser();