From 4254d71039265383403a526da7ea03e86def6e20 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 10 Jun 2020 21:32:54 +0200 Subject: [PATCH] tests: fixes visual testing on windows --- tests/Visual/SingleTestOrDirectory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 261318c3..2b17b876 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -7,7 +7,11 @@ $run = function (string $target, $decorated = false) { $process->run(); - return $decorated ? $process->getOutput() : preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); + $output = $decorated ? $process->getOutput() : preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); + + $output = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? str_replace("\n", "\r\n", $output) : $output; + + return $output; }; $snapshot = function ($name) {