Skip to content

Commit 793b8d3

Browse files
committed
Add baseline ignoring carriage return test.
1 parent 350687d commit 793b8d3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/ErrorBaselineTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,37 @@ public function testLoadShouldIgnoreLineEndingsInIssueSnippet(): void
9898
);
9999
}
100100

101+
public function testShouldIgnoreCarriageReturnInMultilineSnippets(): void
102+
{
103+
$baselineFilePath = 'baseline.xml';
104+
105+
$this->fileProvider->allows()->fileExists($baselineFilePath)->andReturns(true);
106+
$this->fileProvider->allows()->getContents($baselineFilePath)->andReturns(
107+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
108+
<files>
109+
<file src=\"sample/sample-file.php\">
110+
<MixedAssignment>
111+
<code>
112+
foo&#13;
113+
bar&#13;
114+
</code>
115+
</MixedAssignment>
116+
</file>
117+
</files>",
118+
);
119+
120+
$expectedParsedBaseline = [
121+
'sample/sample-file.php' => [
122+
'MixedAssignment' => ['o' => 1, 's' => ["foo\nbar"]],
123+
],
124+
];
125+
126+
$this->assertSame(
127+
$expectedParsedBaseline,
128+
ErrorBaseline::read($this->fileProvider, $baselineFilePath),
129+
);
130+
}
131+
101132
public function testLoadShouldThrowExceptionWhenFilesAreNotDefinedInBaselineFile(): void
102133
{
103134
$this->expectException(ConfigException::class);

0 commit comments

Comments
 (0)