/** * {@inheritdoc} */ public function __construct(ClientInterface $client) { if (!$client->getProfile()->supportsCommands(array('multi', 'exec', 'discard'))) { throw new ClientException("The current profile does not support 'MULTI', 'EXEC' and 'DISCARD'."); } parent::__construct($client); }
/** * {@inheritdoc} */ public function __construct(ClientInterface $client) { if (!$client->getCommandFactory()->supportsCommands(array('multi', 'exec', 'discard'))) { throw new ClientException("'MULTI', 'EXEC' and 'DISCARD' are not supported by the current command factory."); } parent::__construct($client); }
/** * @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); }