Event API
This reference lists the events that plugins and reporters receive during a run.
These signatures are the public API.
Event
Namespace: Greenlight\Event
Defines an event that can occur in the run lifecycle.
interface Event
$occurredAt
Returns a Unix timestamp with microsecond precision.
public float $occurredAt { get; }
RunFinished
Namespace: Greenlight\Event
final readonly class RunFinished implements Event
$runId
public string $runId;
PHPDoc:
@var non-empty-string
$summary
public ResultSummary $summary
$durationSeconds
public float $durationSeconds
$occurredAt
public float $occurredAt
$workerTimings
public array $workerTimings
__construct()
public function __construct(
string $runId,
public ResultSummary $summary,
public float $durationSeconds,
public float $occurredAt,
public array $workerTimings = [],
)
PHPDoc:
@param list<WorkerTiming> $workerTimings Orchestrator-observed worker timing data.@throws \InvalidArgumentException
RunStarted
Namespace: Greenlight\Event
final readonly class RunStarted implements Event
$runId
public string $runId;
PHPDoc:
@var non-empty-string
$plannedTests
public int $plannedTests;
PHPDoc:
@var non-negative-int
$workers
public int $workers;
PHPDoc:
@var positive-int
$occurredAt
public float $occurredAt
$artifactsDirectory
public ?string $artifactsDirectory
__construct()
public function __construct(
string $runId,
int $plannedTests,
int $workers,
public float $occurredAt,
public ?string $artifactsDirectory = null,
)
PHPDoc:
@throws \InvalidArgumentException
TestClassFinished
Namespace: Greenlight\Event
final readonly class TestClassFinished implements Event
$class
public string $class;
PHPDoc:
@var non-empty-string
$occurredAt
public float $occurredAt
$workerId
public string $workerId
__construct()
public function __construct(
string $class,
public float $occurredAt,
public string $workerId = '',
)
PHPDoc:
@param string $workerId The worker that ran the class, or an empty string from a producer without worker attribution@throws \InvalidArgumentException
TestClassStarted
Namespace: Greenlight\Event
final readonly class TestClassStarted implements Event
$class
public string $class;
PHPDoc:
@var non-empty-string
$occurredAt
public float $occurredAt
$workerId
public string $workerId
$isolated
public bool $isolated
__construct()
public function __construct(
string $class,
public float $occurredAt,
public string $workerId = '',
public bool $isolated = false,
)
PHPDoc:
@param string $workerId The worker that ran the class, or an empty string from a producer without worker attribution@throws \InvalidArgumentException
TestFinished
Namespace: Greenlight\Event
final readonly class TestFinished implements Event
$result
public TestResult $result
$occurredAt
public float $occurredAt
__construct()
public function __construct(public TestResult $result, public float $occurredAt)
PHPDoc:
@throws \InvalidArgumentException if $occurredAt is not finite
TestStarted
Namespace: Greenlight\Event
final readonly class TestStarted implements Event
$id
public TestId $id
$occurredAt
public float $occurredAt
__construct()
public function __construct(public TestId $id, public float $occurredAt)
PHPDoc:
@throws \InvalidArgumentException if $occurredAt is not finite
WorkerSpawned
Namespace: Greenlight\Event
final readonly class WorkerSpawned implements Event
$workerId
public string $workerId;
PHPDoc:
@var non-empty-string
$pid
public int $pid;
PHPDoc:
@var positive-int
$occurredAt
public float $occurredAt
__construct()
public function __construct(
string $workerId,
int $pid,
public float $occurredAt,
)
PHPDoc:
@throws \InvalidArgumentException
WorkerTiming
Namespace: Greenlight\Event
Contains orchestrator-observed timing data for one worker process.
A null phase duration means that the worker did not reach both phase endpoints. Idle durations contain only states that the orchestrator can distinguish.
final readonly class WorkerTiming
$workerId
public string $workerId;
PHPDoc:
@var non-empty-string
$assignmentGaps
public int $assignmentGaps;
PHPDoc:
@var non-negative-int
$spawnToHelloSeconds
public ?float $spawnToHelloSeconds
$helloToReadySeconds
public ?float $helloToReadySeconds
$readyToFirstAssignmentSeconds
public ?float $readyToFirstAssignmentSeconds
$assignmentGapSeconds
public float $assignmentGapSeconds
$bootstrapBarrierSeconds
public float $bootstrapBarrierSeconds
$resourceCapacitySeconds
public float $resourceCapacitySeconds
$noQueuedWorkSeconds
public float $noQueuedWorkSeconds
$retirementToExitSeconds
public ?float $retirementToExitSeconds
__construct()
public function __construct(
string $workerId,
public ?float $spawnToHelloSeconds,
public ?float $helloToReadySeconds,
public ?float $readyToFirstAssignmentSeconds,
int $assignmentGaps,
public float $assignmentGapSeconds,
public float $bootstrapBarrierSeconds,
public float $resourceCapacitySeconds,
public float $noQueuedWorkSeconds,
public ?float $retirementToExitSeconds,
)
PHPDoc:
@throws \InvalidArgumentException