Пример #1
0
 /**
  * Create new instance from options
  *
  * @param NotificationInterface $notification
  * @param array                 $options
  *
  * @return Redis
  */
 public static function create(NotificationInterface $notification, array $options = array())
 {
     $options += array('host' => '127.0.0.1', 'port' => 6379, 'timeout' => 0.0, 'list_key' => 'apn.push.queue', 'sleep_timeout' => 250000);
     $redis = new \Redis();
     $redis->connect($options['host'], $options['port'], $options['timeout']);
     $adapter = new RedisAdapter();
     $adapter->setSleepTimeout($options['sleep_timeout'])->setListKey($options['list_key'])->setRedis($redis);
     return new static($adapter, $notification);
 }
Пример #2
0
 /**
  * Get get message with error: List key not found
  *
  * @expectedException \RuntimeException
  */
 public function testGetMessageListKeyNotFound()
 {
     $adapter = new RedisAdapter();
     $adapter->setRedis($this->redis);
     $adapter->getMessage();
 }