/** * {@inheritDoc} */ public function delete(QueueInterface $queue) { $this->redis->multi(); $this->redis->llen($this->getRedisKey($queue)); $this->redis->del($this->getRedisKey($queue)); $this->redis->srem('queues', $queue->getName()); $responses = $this->redis->exec(); if (isset($responses[0])) { return $responses[0]; } return 0; }
function it_deletes_queue_from_redis(QueueInterface $queue, RedisClientInterface $redis) { $queue->getName()->shouldBeCalled()->willReturn('high'); $redis->multi()->shouldBeCalled(); $redis->llen('queue:high')->shouldBeCalled(); $redis->del('queue:high')->shouldBeCalled(); $redis->srem('queues', 'high')->shouldBeCalled(); $redis->exec()->shouldBeCalled()->willReturn(array(5)); $this->delete($queue)->shouldReturn(5); }