Event API
This reference lists the events that plugins and reporters receive during a run.
These signatures are the public API.
Event
Namespace: Greenlight\Core\Event
Add new event types only. Do not replace or remove an event type.
interface Event extends WireSerializable
$occurredAt
Returns a Unix timestamp with microsecond precision.
public float $occurredAt { get; }
RecycleReason
Namespace: Greenlight\Core\Event
enum RecycleReason: string
TestCount
case TestCount = 'test-count';
Memory
case Memory = 'memory';
Crash
case Crash = 'crash';
RunFinished
Namespace: Greenlight\Core\Event
final readonly class RunFinished implements Event
$runId
public string $runId;
PHPDoc:
@var non-empty-string
__construct()
public function __construct(
string $runId,
public ResultSummary $summary,
public float $durationSeconds,
public float $occurredAt,
)
PHPDoc:
@throws \InvalidArgumentException
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
RunStarted
Namespace: Greenlight\Core\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
__construct()
public function __construct(
string $runId,
int $plannedTests,
int $workers,
public float $occurredAt,
public ?string $artifactsDirectory = null,
)
PHPDoc:
@throws \InvalidArgumentException
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
SuiteFinished
Namespace: Greenlight\Core\Event
final readonly class SuiteFinished implements Event
$suite
public string $suite;
PHPDoc:
@var non-empty-string
__construct()
public function __construct(string $suite, public float $occurredAt)
PHPDoc:
@throws \InvalidArgumentException
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
SuiteStarted
Namespace: Greenlight\Core\Event
final readonly class SuiteStarted implements Event
$suite
public string $suite;
PHPDoc:
@var non-empty-string
__construct()
public function __construct(string $suite, public float $occurredAt)
PHPDoc:
@throws \InvalidArgumentException
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
TestClassFinished
Namespace: Greenlight\Core\Event
final readonly class TestClassFinished implements Event
$class
public string $class;
PHPDoc:
@var non-empty-string
__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
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
TestClassStarted
Namespace: Greenlight\Core\Event
final readonly class TestClassStarted implements Event
$class
public string $class;
PHPDoc:
@var non-empty-string
__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
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
TestFinished
Namespace: Greenlight\Core\Event
final readonly class TestFinished implements Event
__construct()
public function __construct(public TestResult $result, public float $occurredAt)
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
TestStarted
Namespace: Greenlight\Core\Event
final readonly class TestStarted implements Event
__construct()
public function __construct(public TestId $id, public float $occurredAt)
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
WorkerRecycled
Namespace: Greenlight\Core\Event
final readonly class WorkerRecycled implements Event
$workerId
public string $workerId;
PHPDoc:
@var non-empty-string
__construct()
public function __construct(
string $workerId,
public RecycleReason $reason,
public float $occurredAt,
)
PHPDoc:
@throws \InvalidArgumentException
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static
WorkerSpawned
Namespace: Greenlight\Core\Event
final readonly class WorkerSpawned implements Event
$workerId
public string $workerId;
PHPDoc:
@var non-empty-string
$pid
public int $pid;
PHPDoc:
@var positive-int
__construct()
public function __construct(
string $workerId,
int $pid,
public float $occurredAt,
)
PHPDoc:
@throws \InvalidArgumentException
toWire()
[\Override]
public function toWire(): array
fromWire()
[\Override]
public static function fromWire(array $payload): static