function it_handles_a_command(Application $app, CommandStub $command, CommandTranslator $translator, CommandHandlerStub $handler)
 {
     $translator->toCommandHandler($command)->willReturn('CommandHandler');
     $app->make('CommandHandler')->willReturn($handler);
     $handler->handle($command)->shouldBeCalled();
     $this->execute($command);
 }
Beispiel #2
0
 /**
  * Execute the command
  *
  * @param $command
  * @return mixed
  */
 public function execute($command)
 {
     $handler = $this->commandTranslator->toCommandHandler($command);
     return $this->app->make($handler)->handle($command);
 }