This commit is contained in:
nuno maduro
2026-05-01 21:22:33 +01:00
parent b2c07561e7
commit 6e0e030d71
4 changed files with 24 additions and 205 deletions

View File

@ -11,17 +11,22 @@ use PHPUnit\Framework\TestStatus\TestStatus;
*/
enum Replay
{
case No;
case Pass;
case Skipped;
case Incomplete;
case Failure;
public static function from(TestStatus $cached): self
public static function fromStatus(?TestStatus $status): self
{
if (! $status instanceof TestStatus) {
return self::No;
}
return match (true) {
$cached->isSuccess(), $cached->isRisky() => self::Pass,
$cached->isSkipped() => self::Skipped,
$cached->isIncomplete() => self::Incomplete,
$status->isSuccess(), $status->isRisky() => self::Pass,
$status->isSkipped() => self::Skipped,
$status->isIncomplete() => self::Incomplete,
default => self::Failure,
};
}