From 75d87ed9d47cc9cacd4e232112dcd2fed6745a8a Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 19 Jul 2023 23:27:10 +0800 Subject: [PATCH 1/2] Fix failures due to line ending --- tests/system/Commands/RoutesTest.php | 2 +- tests/system/Commands/Utilities/NamespacesTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 6d506274145d..bb89d35bb96d 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -39,7 +39,7 @@ protected function tearDown(): void protected function getBuffer() { - return $this->getStreamFilterBuffer(); + return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); } private function getCleanRoutes(): RouteCollection diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index 1b9d15a9e361..b561e4eea599 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -37,7 +37,7 @@ protected function tearDown(): void protected function getBuffer() { - return $this->getStreamFilterBuffer(); + return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); } public function testNamespacesCommandCodeIgniterOnly() From ccbfcfa7a7339d277606f7b2c2e0c6d19b67dfdb Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 25 Jul 2023 13:51:30 +0800 Subject: [PATCH 2/2] Fix failures due to path in heredoc --- tests/system/Commands/Utilities/NamespacesTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index b561e4eea599..26eabd32895f 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -35,9 +35,16 @@ protected function tearDown(): void $this->resetServices(); } + /** + * @see https://regex101.com/r/l3lHfR/1 + */ protected function getBuffer() { - return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); + return preg_replace_callback('/(\|\s*[^|]+\s*\|\s*)(.*?)(\s*\|\s*[^|]+\s*\|)/', static function (array $matches) { + $matches[2] = str_replace(DIRECTORY_SEPARATOR, '/', $matches[2]); + + return $matches[1] . $matches[2] . $matches[3]; + }, str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer())); } public function testNamespacesCommandCodeIgniterOnly()