Beispiel #1
0
 /**
  * @runInSeparateProcess
  * @preserveGlobalState disabled
  */
 public function testPubSubWithClientUsedInSubClosure()
 {
     $process = CM_Process::getInstance();
     $process->fork(function () {
         $redisClient = CM_Service_Manager::getInstance()->getRedis();
         $clientCount = 0;
         while ($clientCount == 0) {
             $clientCount = $redisClient->publish('foo', 'test');
             usleep(50 * 1000);
         }
     });
     $this->_client->set('check', 'bar');
     $response = $this->_client->subscribe('foo', function ($channel, $message) {
         if ($message == 'test') {
             return [$channel, $message, $this->_client->get('check')];
         } else {
             return false;
         }
     });
     $this->assertSame(['foo', 'test', 'bar'], $response);
     $process->waitForChildren();
 }
Beispiel #2
0
 /**
  * @expectedException CM_Exception_Invalid
  */
 public function testLPushInvalidEntry()
 {
     $this->_client->set('foo', 12);
     $this->_client->lPush('foo', 'bar1');
 }