Browse documentation

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

View source

$occurredAt

Returns a Unix timestamp with microsecond precision.

public float $occurredAt { get; }

View source

RecycleReason

Namespace: Greenlight\Core\Event

enum RecycleReason: string

View source

TestCount

case TestCount = 'test-count';

View source

Memory

case Memory = 'memory';

View source

Crash

case Crash = 'crash';

View source

RunFinished

Namespace: Greenlight\Core\Event

final readonly class RunFinished implements Event

View source

$runId

public string $runId;

PHPDoc:

View source

__construct()

public function __construct(
    string $runId,
    public ResultSummary $summary,
    public float $durationSeconds,
    public float $occurredAt,
)

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

RunStarted

Namespace: Greenlight\Core\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

__construct()

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

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

SuiteFinished

Namespace: Greenlight\Core\Event

final readonly class SuiteFinished implements Event

View source

$suite

public string $suite;

PHPDoc:

View source

__construct()

public function __construct(string $suite, public float $occurredAt)

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

SuiteStarted

Namespace: Greenlight\Core\Event

final readonly class SuiteStarted implements Event

View source

$suite

public string $suite;

PHPDoc:

View source

__construct()

public function __construct(string $suite, public float $occurredAt)

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

TestClassFinished

Namespace: Greenlight\Core\Event

final readonly class TestClassFinished implements Event

View source

$class

public string $class;

PHPDoc:

View source

__construct()

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

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

TestClassStarted

Namespace: Greenlight\Core\Event

final readonly class TestClassStarted implements Event

View source

$class

public string $class;

PHPDoc:

View source

__construct()

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

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

TestFinished

Namespace: Greenlight\Core\Event

final readonly class TestFinished implements Event

View source

__construct()

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

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

TestStarted

Namespace: Greenlight\Core\Event

final readonly class TestStarted implements Event

View source

__construct()

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

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

WorkerRecycled

Namespace: Greenlight\Core\Event

final readonly class WorkerRecycled implements Event

View source

$workerId

public string $workerId;

PHPDoc:

View source

__construct()

public function __construct(
    string $workerId,
    public RecycleReason $reason,
    public float $occurredAt,
)

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source

WorkerSpawned

Namespace: Greenlight\Core\Event

final readonly class WorkerSpawned implements Event

View source

$workerId

public string $workerId;

PHPDoc:

View source

$pid

public int $pid;

PHPDoc:

View source

__construct()

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

PHPDoc:

View source

toWire()

[\Override]
public function toWire(): array

View source

fromWire()

[\Override]
public static function fromWire(array $payload): static

View source