/** * @test */ function it_detaches_listener_aggregate() { $listener1 = new ActionEventListenerMock(); $listenerAggregate = new ActionListenerAggregateMock(); $actionEvent = $this->proophActionEventEmitter->getNewActionEvent("test", $this, ['payload' => true]); $this->proophActionEventEmitter->attachListener("test", $listener1); $this->proophActionEventEmitter->attachListenerAggregate($listenerAggregate); $this->proophActionEventEmitter->detachListenerAggregate($listenerAggregate); $this->proophActionEventEmitter->dispatch($actionEvent); //If aggregate is not detached it would stop the event propagation and $listener1 would not be triggered $this->assertSame($actionEvent, $listener1->lastEvent); }
/** * @test */ public function it_uses_default_event_name_if_none_given() { $event = $this->proophActionEventEmitter->getNewActionEvent(); $this->assertEquals('action_event', $event->getName()); }