assertTrue($collector->hasDispatched('stdClass')); $this->assertCount(1, $collector->getEvents()); $this->assertSame($event, $collector->getEvents()[0]); } public function test_assertions_work_correctly(): void { // Note: Manual registration for the test of the trait itself $this->eventCollector = new EventCollector(); $provider = new ListenerProvider(); $provider->addListener('*', $this->eventCollector); $dispatcher = new EventDispatcher($provider); $dispatcher->dispatch(new \stdClass()); $this->assertEventDispatched('stdClass'); $this->assertEventNotDispatched('RuntimeException'); } }