[Yaml] simplify the test

This commit is contained in:
Christian Flothmann 2020-09-18 17:57:36 +02:00
parent 7fa12576ef
commit bb64fc9c3b
1 changed files with 3 additions and 9 deletions

View File

@ -2381,19 +2381,13 @@ a:
c: d
YAML;
$expected = ['a' => ['b' => "row\nrow2\n"], 'c' => 'd'];
// The parser was not used before, so there is a new line after row2
$this->assertSame($expected, $this->parser->parse($longDocument));
$parser = new Parser();
// The first parsing set and fixed the totalNumberOfLines in the Parser before, so parsing the short document here
// to reproduce the issue. If the issue would not have been fixed, the next assertion will fail
$parser->parse($shortDocument);
$this->parser->parse($shortDocument);
// After the total number of lines has been rset the result will be the same as if a new parser was used
// After the total number of lines has been reset the result will be the same as if a new parser was used
// (before, there was no \n after row2)
$this->assertSame($expected, $parser->parse($longDocument));
$this->assertSame(['a' => ['b' => "row\nrow2\n"], 'c' => 'd'], $this->parser->parse($longDocument));
}
}