/**
  * @group disconnected
  */
 public function testProperlyDiscardsTransactionAfterServerExceptionInBlock()
 {
     $connection = $this->getMockedConnection(function (CommandInterface $command) {
         switch ($command->getId()) {
             case 'MULTI':
                 return true;
             case 'ECHO':
                 return new ResponseError('ERR simulated failure on ECHO');
             case 'EXEC':
                 return new ResponseError('EXECABORT Transaction discarded because of previous errors.');
             default:
                 return new ResponseQueued();
         }
     });
     $client = new Client($connection);
     // First attempt
     $tx = new MultiExecContext($client);
     try {
         $tx->multi()->set('foo', 'bar')->echo('simulated failure')->exec();
     } catch (\Exception $exception) {
         $this->assertInstanceOf('Predis\\Transaction\\AbortedMultiExecException', $exception);
         $this->assertSame('ERR simulated failure on ECHO', $exception->getMessage());
     }
     // Second attempt
     $tx = new MultiExecContext($client);
     try {
         $tx->multi()->set('foo', 'bar')->echo('simulated failure')->exec();
     } catch (\Exception $exception) {
         $this->assertInstanceOf('Predis\\Transaction\\AbortedMultiExecException', $exception);
         $this->assertSame('ERR simulated failure on ECHO', $exception->getMessage());
     }
 }