/** * @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); }