/** * @param ChangePostTitleCommand $command */ public function changePostTitle(ChangePostTitleCommand $command) { $this->eventBus->dispatch(new PostTitleWasChanged($command->title())); }
/** * @param DomainEventInterface $event */ protected function dispatch(DomainEventInterface $event) { $this->eventBus->dispatch($event); }
/** * Test create without event dispatcher middleware. */ public function testCreateWithoutEventDispatcherMiddleware() { $this->given($middleware = new LockingMiddleware())->and($eventBus = new EventBus([$middleware]))->then()->exception(function () use($eventBus) { $eventBus->dispatch(new LoginUserEvent('*****@*****.**')); })->isInstanceOf(NotFoundException::class); }