Skip to content

Commit 7201792

Browse files
authored
Merge pull request #18 from WyriHaximus/ci-appveyor-lesstrict-filecomparison
Fix windows file comparison
2 parents bfa2d37 + 26b9fe7 commit 7201792

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

tests/ResourceGeneratorTest.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,32 @@ public function testOutput()
5959
$objectPath = substr($name, strlen($resourcesPath));
6060

6161
$this->assertFileExists($this->temporaryDirectory . $objectPath);
62+
63+
$expected = file_get_contents($resourcesPath . $objectPath);
64+
$actual = file_get_contents($this->temporaryDirectory . $objectPath);
65+
66+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
67+
$expected = str_replace(
68+
[
69+
"\r",
70+
"\n",
71+
],
72+
'',
73+
$expected
74+
);
75+
$actual = str_replace(
76+
[
77+
"\r",
78+
"\n",
79+
],
80+
'',
81+
$actual
82+
);
83+
}
84+
6285
$this->assertSame(
63-
file_get_contents($resourcesPath . $objectPath),
64-
file_get_contents($this->temporaryDirectory . $objectPath),
86+
$expected,
87+
$actual,
6588
$objectPath
6689
);
6790
}

0 commit comments

Comments
 (0)