mirror of
https://github.com/pestphp/pest.git
synced 2026-06-05 02:52:12 +02:00
fix
This commit is contained in:
@ -57,7 +57,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
|
|||||||
/** Sentinel dropped by a recording worker without a usable coverage driver. */
|
/** Sentinel dropped by a recording worker without a usable coverage driver. */
|
||||||
private const string KEY_WORKER_NO_DRIVER_PREFIX = 'worker-no-driver-';
|
private const string KEY_WORKER_NO_DRIVER_PREFIX = 'worker-no-driver-';
|
||||||
|
|
||||||
public const string KEY_COVERAGE_CACHE = 'coverage.bin';
|
public const string KEY_COVERAGE_CACHE = 'coverage.bin.gz';
|
||||||
|
|
||||||
public const string KEY_COVERAGE_MARKER = 'coverage.marker';
|
public const string KEY_COVERAGE_MARKER = 'coverage.marker';
|
||||||
|
|
||||||
|
|||||||
@ -34,13 +34,21 @@ final class CoverageMerger
|
|||||||
$current = self::requireCoverage($reportPath);
|
$current = self::requireCoverage($reportPath);
|
||||||
|
|
||||||
if ($current instanceof CodeCoverage) {
|
if ($current instanceof CodeCoverage) {
|
||||||
$state->write(Tia::KEY_COVERAGE_CACHE, serialize($current));
|
$state->write(Tia::KEY_COVERAGE_CACHE, self::compress(serialize($current)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cached = self::unserializeCoverage($cachedBytes);
|
$decoded = self::decompress($cachedBytes);
|
||||||
|
|
||||||
|
if ($decoded === null) {
|
||||||
|
$state->delete(Tia::KEY_COVERAGE_CACHE);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cached = self::unserializeCoverage($decoded);
|
||||||
$current = self::requireCoverage($reportPath);
|
$current = self::requireCoverage($reportPath);
|
||||||
|
|
||||||
if (! $cached instanceof CodeCoverage || ! $current instanceof CodeCoverage) {
|
if (! $cached instanceof CodeCoverage || ! $current instanceof CodeCoverage) {
|
||||||
@ -59,7 +67,21 @@ final class CoverageMerger
|
|||||||
$reportPath,
|
$reportPath,
|
||||||
'<?php return unserialize('.var_export($serialised, true).");\n",
|
'<?php return unserialize('.var_export($serialised, true).");\n",
|
||||||
);
|
);
|
||||||
$state->write(Tia::KEY_COVERAGE_CACHE, $serialised);
|
$state->write(Tia::KEY_COVERAGE_CACHE, self::compress($serialised));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function compress(string $bytes): string
|
||||||
|
{
|
||||||
|
$compressed = @gzencode($bytes);
|
||||||
|
|
||||||
|
return $compressed === false ? $bytes : $compressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function decompress(string $bytes): ?string
|
||||||
|
{
|
||||||
|
$decoded = @gzdecode($bytes);
|
||||||
|
|
||||||
|
return $decoded === false ? null : $decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user