function it_can_trigger_decorators_before_calling_the_handler(Application $app, CommandStub $command, CommandTranslator $translator, CommandHandlerStub $handler)
 {
     $translator->toCommandHandler($command)->willReturn('CommandHandler');
     $app->make('CommandHandler')->willReturn($handler);
     $handler->handle($command)->shouldBeCalled();
     // If we specify a decorator before calling execute(), that decorator should be
     // resolved out of the container and executed first.
     $decorator = 'spec\\Laracasts\\Commander\\CommandBusDecoratorStub';
     $app->make($decorator)->shouldBeCalled()->willReturn(new CommandBusDecoratorStub());
     $this->decorate($decorator)->execute($command);
 }
 /**
  * Execute the command
  *
  * @param $command
  * @return mixed
  */
 public function execute($command)
 {
     $this->executeDecorators($command);
     $handler = $this->commandTranslator->toCommandHandler($command);
     return $this->app->make($handler)->handle($command);
 }