Skip to content

Commit 5319cff

Browse files
committed
Fix failures due to path in heredoc
1 parent 75d87ed commit 5319cff

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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 str_replace(PHP_EOL, "\n", $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)