/** * {@inheritDoc} */ public function get(JobInterface $job) { if (!$this->isTracking($job)) { return false; } $statusPacket = json_decode($this->redis->get($this->getRedisKey($job)), true); if (!$statusPacket) { return false; } return $statusPacket['status']; }
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); }
function it_returns_0_when_name_is_unknown(RedisClientInterface $redis) { $redis->get('stat:unknown')->shouldBeCalled()->willReturn(false); $this->get('unknown')->shouldReturn(0); }