sync latest changes

This commit is contained in:
Adrian Nürnberger
2025-01-20 09:06:03 +01:00
parent 709ecb1ba2
commit 7760d945bb

View File

@ -46,6 +46,7 @@ declare(strict_types=1);
namespace PHPUnit\Runner\ResultCache;
use const DIRECTORY_SEPARATOR;
use const LOCK_EX;
use PHPUnit\Framework\TestStatus\TestStatus;
use PHPUnit\Runner\DirectoryCannotBeCreatedException;
@ -65,6 +66,8 @@ use function json_encode;
use function Pest\version;
/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class DefaultResultCache implements ResultCache
@ -77,12 +80,12 @@ final class DefaultResultCache implements ResultCache
private readonly string $cacheFilename;
/**
* @psalm-var array<string, TestStatus>
* @var array<string, TestStatus>
*/
private array $defects = [];
/**
* @psalm-var array<string, float>
* @var array<string, float>
*/
private array $times = [];
@ -119,6 +122,17 @@ final class DefaultResultCache implements ResultCache
return $this->times[$id] ?? 0.0;
}
public function mergeWith(self $other): void
{
foreach ($other->defects as $id => $defect) {
$this->defects[$id] = $defect;
}
foreach ($other->times as $id => $time) {
$this->times[$id] = $time;
}
}
public function load(): void
{
if (! is_file($this->cacheFilename)) {