Skip to content

Commit f6d834e

Browse files
authored
Merge pull request #7719 from paulbalandan/failing-tests
Fix failing tests in Windows for RoutesTest and NamespacesTest
2 parents 5c51240 + ccbfcfa commit f6d834e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tests/system/Commands/RoutesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function tearDown(): void
3939

4040
protected function getBuffer()
4141
{
42-
return $this->getStreamFilterBuffer();
42+
return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer());
4343
}
4444

4545
private function getCleanRoutes(): RouteCollection

tests/system/Commands/Utilities/NamespacesTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ protected function tearDown(): void
3535
$this->resetServices();
3636
}
3737

38+
/**
39+
* @see https://regex101.com/r/l3lHfR/1
40+
*/
3841
protected function getBuffer()
3942
{
40-
return $this->getStreamFilterBuffer();
43+
return preg_replace_callback('/(\|\s*[^|]+\s*\|\s*)(.*?)(\s*\|\s*[^|]+\s*\|)/', static function (array $matches) {
44+
$matches[2] = str_replace(DIRECTORY_SEPARATOR, '/', $matches[2]);
45+
46+
return $matches[1] . $matches[2] . $matches[3];
47+
}, str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()));
4148
}
4249

4350
public function testNamespacesCommandCodeIgniterOnly()

0 commit comments

Comments
 (0)