/**
  * @group disconnected
  */
 public function testPubSubWithArrayAndCallableExecutesPubSub()
 {
     // NOTE: we use a subscribe count of 0 in the fake message to trick
     //       the context and to make it think that it can be closed
     //       since there are no more subscriptions active.
     $message = array('subscribe', 'channel', 0);
     $options = array('subscribe' => 'channel');
     $connection = $this->getMock('Predis\\Connection\\SingleConnectionInterface');
     $connection->expects($this->once())->method('read')->will($this->returnValue($message));
     $callable = $this->getMock('stdClass', array('__invoke'));
     $callable->expects($this->once())->method('__invoke');
     $client = new Client($connection);
     $client->pubSub($options, $callable);
 }
Example #2
0
 /**
  * @group disconnected
  */
 public function testPubSubIsAliasForPubSubLoop()
 {
     $client = new Client();
     $this->assertInstanceOf('Predis\\PubSub\\PubSubContext', $client->pubSub());
 }
Example #3
0
 /**
  * @param Client Client instance used by the context.
  */
 public function __construct(Client $client)
 {
     $this->callbacks = array();
     $this->client = $client;
     $this->pubSubContext = $client->pubSub();
 }