/**
  * @expectedException InvalidArgumentException
  */
 public function testExecuteWithIncorrectDecorator()
 {
     $handler = m::mock('JildertMiedema\\Commander\\CommandHandler');
     $this->resolver->shouldReceive('resolve')->with('TestHandler')->andReturn($handler);
     $decorator = m::mock('StdClass');
     $this->resolver->shouldReceive('resolve')->with('Decorator')->andReturn($decorator);
     $this->commandBus->decorate('Decorator');
     $command = m::mock('TestCommand');
     $this->commandBus->execute($command);
 }
 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);
 }