From 6c4fd61db5e8ee87fcf833d2af91ddc90c565ce9 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 5 Jun 2020 20:51:57 +0200 Subject: [PATCH] tests: fixes testing running in php 7.3 --- tests/Visual/SingleTestOrDirectory.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 70222546..261318c3 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -10,12 +10,15 @@ $run = function (string $target, $decorated = false) { return $decorated ? $process->getOutput() : preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); }; -$testsPath = dirname(__DIR__); -$snapshot = fn (string $name) => file_get_contents(implode(DIRECTORY_SEPARATOR, [ - $testsPath, - '.snapshots', - "$name.txt", -])); +$snapshot = function ($name) { + $testsPath = dirname(__DIR__); + + return file_get_contents(implode(DIRECTORY_SEPARATOR, [ + $testsPath, + '.snapshots', + "$name.txt", + ])); +}; test('allows to run a single test', function () use ($run, $snapshot) { assertStringContainsString(