function it_can_tell_if_a_queue_is_already_registered(QueueInterface $queue, RedisClientInterface $redis) { $queue->getName()->shouldBeCalled()->willReturn('foo'); $this->has($queue)->shouldReturn(false); $redis->exists('queue:foo')->willReturn(1); $this->has($queue)->shouldReturn(true); $redis->exists('queue:foo')->willReturn(0); $this->has($queue)->shouldReturn(false); }
function it_when_asked_if_job_is_complete_returns_false_when_it_is_not_complete(RedisClientInterface $redis, JobInterface $job) { $job->getId()->willReturn('baz'); $redis->exists('job:baz:status')->shouldBeCalled()->willReturn(true); $redis->get('job:baz:status')->shouldBeCalled()->willReturn('{"status": "processing"}'); $this->isComplete($job)->shouldReturn(false); }
/** * {@inheritDoc} */ public function isTracking(JobInterface $job) { return $this->redis->exists($this->getRedisKey($job)); }
/** * {@inheritDoc} */ public function has(QueueInterface $queue) { return $this->redis->exists($this->getRedisKey($queue)) == 1 ? true : false; }