Greenlight

Documentation

API reference

On this page

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

View source

$occurredAt

Returns a Unix timestamp with microsecond precision.

public float $occurredAt { get; }

View source

RunFinished

Namespace: Greenlight\Event

final readonly class RunFinished implements Event

View source

$runId

public string $runId;

PHPDoc:

View source

$summary

public ResultSummary $summary

View source

$durationSeconds

public float $durationSeconds

View source

$occurredAt

public float $occurredAt

View source

$workerTimings

public array $workerTimings

View source

__construct()

public function __construct(
    string $runId,
    public ResultSummary $summary,
    public float $durationSeconds,
    public float $occurredAt,
    public array $workerTimings = [],
)

PHPDoc:

View source

RunStarted

Namespace: Greenlight\Event

final readonly class RunStarted implements Event

View source

$runId

public string $runId;

PHPDoc:

View source

$plannedTests

public int $plannedTests;

PHPDoc:

View source

$workers

public int $workers;

PHPDoc:

View source

$occurredAt

public float $occurredAt

View source

$artifactsDirectory

public ?string $artifactsDirectory

View source

__construct()

public function __construct(
    string $runId,
    int $plannedTests,
    int $workers,
    public float $occurredAt,
    public ?string $artifactsDirectory = null,
)

PHPDoc:

View source

TestClassFinished

Namespace: Greenlight\Event

final readonly class TestClassFinished implements Event

View source

$class

public string $class;

PHPDoc:

View source

$occurredAt

public float $occurredAt

View source

$workerId

public string $workerId

View source

__construct()

public function __construct(
    string $class,
    public float $occurredAt,
    public string $workerId = '',
)

PHPDoc:

View source

TestClassStarted

Namespace: Greenlight\Event

final readonly class TestClassStarted implements Event

View source

$class

public string $class;

PHPDoc:

View source

$occurredAt

public float $occurredAt

View source

$workerId

public string $workerId

View source

$isolated

public bool $isolated

View source

__construct()

public function __construct(
    string $class,
    public float $occurredAt,
    public string $workerId = '',
    public bool $isolated = false,
)

PHPDoc:

View source

TestFinished

Namespace: Greenlight\Event

final readonly class TestFinished implements Event

View source

$result

public TestResult $result

View source

$occurredAt

public float $occurredAt

View source

__construct()

public function __construct(public TestResult $result, public float $occurredAt)

PHPDoc:

View source

TestStarted

Namespace: Greenlight\Event

final readonly class TestStarted implements Event

View source

$id

public TestId $id

View source

$occurredAt

public float $occurredAt

View source

__construct()

public function __construct(public TestId $id, public float $occurredAt)

PHPDoc:

View source

WorkerSpawned

Namespace: Greenlight\Event

final readonly class WorkerSpawned implements Event

View source

$workerId

public string $workerId;

PHPDoc:

View source

$pid

public int $pid;

PHPDoc:

View source

$occurredAt

public float $occurredAt

View source

__construct()

public function __construct(
    string $workerId,
    int $pid,
    public float $occurredAt,
)

PHPDoc:

View source

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

View source

$workerId

public string $workerId;

PHPDoc:

View source

$assignmentGaps

public int $assignmentGaps;

PHPDoc:

View source

$spawnToHelloSeconds

public ?float $spawnToHelloSeconds

View source

$helloToReadySeconds

public ?float $helloToReadySeconds

View source

$readyToFirstAssignmentSeconds

public ?float $readyToFirstAssignmentSeconds

View source

$assignmentGapSeconds

public float $assignmentGapSeconds

View source

$bootstrapBarrierSeconds

public float $bootstrapBarrierSeconds

View source

$resourceCapacitySeconds

public float $resourceCapacitySeconds

View source

$noQueuedWorkSeconds

public float $noQueuedWorkSeconds

View source

$retirementToExitSeconds

public ?float $retirementToExitSeconds

View source

__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:

View source