tests: fixes testing running in php 7.3

This commit is contained in:
Nuno Maduro
2020-06-05 20:51:57 +02:00
parent afbbc35984
commit 6c4fd61db5

View File

@ -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, [
$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(