/**
* @group disconnected
*/
public function testExecuteWithCallableArgumentHandlesExceptions()
{
$exception = null;
$connection = $this->getMock('Predis\\Connection\\NodeConnectionInterface');
$connection->expects($this->never())->method('writeRequest');
$connection->expects($this->never())->method('readResponse');
$pipeline = new Pipeline(new Client($connection));
$exception = null;
$responses = null;
try {
$responses = $pipeline->execute(function ($pipe) {
$pipe->echo('one');
$pipe->echo('two');
throw new ClientException('TEST');
});
} catch (\Exception $exception) {
// NOOP
}
$this->assertInstanceOf('Predis\\ClientException', $exception);
$this->assertSame('TEST', $exception->getMessage());
$this->assertNull($responses);
}