Author: Daniele Alessandri (suppakilla@gmail.com)
Inheritance: implements Predis\ClientContextInterface
Ejemplo n.º 1
0
 /**
  * {@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);
 }
Ejemplo n.º 2
0
 /**
  * {@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);
 }
Ejemplo n.º 3
0
 /**
  * @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);
 }