public function testExecuteWithDecorator()
 {
     $handler = m::mock('JildertMiedema\\Commander\\CommandHandler');
     $decorator = m::mock('JildertMiedema\\Commander\\CommandBus');
     $this->resolver->shouldReceive('resolve')->with('TestHandler')->andReturn($handler);
     $this->resolver->shouldReceive('resolve')->with('Decorator')->andReturn($decorator);
     $this->translator->shouldReceive('toCommandHandler')->once()->andReturn('TestHandler');
     $handler->shouldReceive('handle')->once()->andReturn('Result');
     $decorator->shouldReceive('execute')->once();
     $this->commandBus->decorate('Decorator');
     $command = m::mock('TestCommand');
     $result = $this->commandBus->execute($command);
     $this->assertEquals('Result', $result);
 }
 public function testExecuteWithDecorator()
 {
     $validator = m::mock('JildertMiedema\\Commander\\ValidationInterface');
     $decorator = m::mock('JildertMiedema\\Commander\\CommandBus');
     $this->resolver->shouldReceive('canResolve')->with('Validator')->andReturn(true);
     $this->resolver->shouldReceive('resolve')->with('Validator')->andReturn($validator);
     $this->resolver->shouldReceive('resolve')->with('Decorator')->andReturn($decorator);
     $this->translator->shouldReceive('toValidator')->once()->andReturn('Validator');
     $validator->shouldReceive('validate')->once()->andReturn(true);
     $this->defaultCommandBus->shouldReceive('execute')->once()->andReturn('Result');
     $decorator->shouldReceive('execute')->once();
     $this->commandBus->decorate('Decorator');
     $command = m::mock('TestCommand');
     $result = $this->commandBus->execute($command);
     $this->assertEquals('Result', $result);
 }