1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Add baseline ignoring carriage return test.

This commit is contained in:
Damian Wójcik 2023-03-28 14:40:11 +02:00
parent 350687dcb7
commit 793b8d34d8

View File

@ -98,6 +98,37 @@ class ErrorBaselineTest extends TestCase
); );
} }
public function testShouldIgnoreCarriageReturnInMultilineSnippets(): void
{
$baselineFilePath = 'baseline.xml';
$this->fileProvider->allows()->fileExists($baselineFilePath)->andReturns(true);
$this->fileProvider->allows()->getContents($baselineFilePath)->andReturns(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<files>
<file src=\"sample/sample-file.php\">
<MixedAssignment>
<code>
foo&#13;
bar&#13;
</code>
</MixedAssignment>
</file>
</files>",
);
$expectedParsedBaseline = [
'sample/sample-file.php' => [
'MixedAssignment' => ['o' => 1, 's' => ["foo\nbar"]],
],
];
$this->assertSame(
$expectedParsedBaseline,
ErrorBaseline::read($this->fileProvider, $baselineFilePath),
);
}
public function testLoadShouldThrowExceptionWhenFilesAreNotDefinedInBaselineFile(): void public function testLoadShouldThrowExceptionWhenFilesAreNotDefinedInBaselineFile(): void
{ {
$this->expectException(ConfigException::class); $this->expectException(ConfigException::class);