Skip to content

EventTracer

github-actions edited this page Apr 2, 2026 · 1 revision

Collects PHPUnit events grouped by their concrete event class.

This tracer MUST store every received event instance under its fully qualified class name so tests MAY later inspect which events were emitted and how many times each event type occurred during execution.

The collected events SHALL remain available in memory for the lifetime of this tracer instance. Consumers SHOULD treat the stored event collection as test-support state and SHOULD NOT rely on it for production behavior.


  • Full name: \FastForward\DevTools\PhpUnit\Event\EventTracer
  • This class implements: Tracer

Methods

trace

Records a PHPUnit event in the internal event registry.

public trace(\PHPUnit\Event\Event $event): void

This method MUST group the event by its concrete runtime class and SHALL append the received instance to the corresponding event list without discarding previously traced events of the same type.

Parameters:

Parameter Type Description
$event \PHPUnit\Event\Event the PHPUnit event instance to record

count

Returns the number of traced events for the given event class.

public count(class-string<\PHPUnit\Event\Event> $eventClass): int

This method MUST return the exact number of stored events matching the provided fully qualified event class name. When no events were recorded for the given class, the method SHALL return 0.

Parameters:

Parameter Type Description
$eventClass class-string<\PHPUnit\Event\Event> the fully qualified PHPUnit event
class name to count

Return Value:

the number of recorded events for the specified class


Clone this wiki locally