Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(MessageInterface $event)
 {
     if (!$event instanceof EventInterface) {
         throw new \InvalidArgumentException(sprintf('The object must be an instance of %s. Instance of %s given', EventInterface::class, get_class($event)));
     }
     $this->ensureEventDispatcherMiddleware();
     parent::dispatch($event);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(MessageInterface $command)
 {
     if (!$command instanceof CommandInterface) {
         throw new \InvalidArgumentException(sprintf('The object must be an instance of %s. Instance of %s given', CommandInterface::class, get_class($command)));
     }
     $this->ensureCommandHandlerMiddleware();
     parent::dispatch($command);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(MessageInterface $query)
 {
     if (!$query instanceof QueryInterface) {
         throw new \InvalidArgumentException(sprintf('The object must be an instance of %s. Instance of %s given', QueryInterface::class, get_class($query)));
     }
     $this->ensureQueryHandlerMiddleware();
     return parent::dispatch($query);
 }
Exemplo n.º 4
0
 /**
  * Test dispatch method.
  */
 public function testDispatch()
 {
     $this->given($middleware = new LockingMiddleware())->and($bus = new Bus([12 => $middleware]))->when($result = $bus->dispatch(new FooMessage()))->then()->variable($result)->isNull();
 }