fix: cache being mixed with phpunit

This commit is contained in:
Nuno Maduro
2023-02-20 22:38:03 +00:00
parent 683910bff4
commit 2a1db41880

View File

@ -47,6 +47,7 @@ namespace PHPUnit\Runner\ResultCache;
use function array_keys;
use function assert;
use function Pest\version;
use const DIRECTORY_SEPARATOR;
use function dirname;
use function file_get_contents;
@ -66,11 +67,6 @@ use PHPUnit\Util\Filesystem;
*/
final class DefaultResultCache implements ResultCache
{
/**
* @var int
*/
private const VERSION = 1;
/**
* @var string
*/
@ -138,7 +134,7 @@ final class DefaultResultCache implements ResultCache
return;
}
if ($data['version'] !== self::VERSION) {
if ($data['version'] !== $this->cacheVersion()) {
return;
}
@ -163,7 +159,7 @@ final class DefaultResultCache implements ResultCache
}
$data = [
'version' => self::VERSION,
'version' => $this->cacheVersion(),
'defects' => [],
'times' => $this->times,
];
@ -178,4 +174,12 @@ final class DefaultResultCache implements ResultCache
LOCK_EX
);
}
/**
* Returns the cache version.
*/
private function cacheVersion(): string
{
return 'pest_' . version();
}
}