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_loads_all_queue_names_from_redis(RedisClientInterface $redis) { $redis->smembers('queues')->shouldBeCalled()->willReturn(array('high', 'low', 'medium')); $this->all()->shouldReturn(array('high', 'low', 'medium')); }
function it_saves_failed_jobs_to_redis(RedisClientInterface $redis, JobInterface $job, \Exception $exception, WorkerInterface $worker) { $redis->rpush('failed', Argument::containingString('"payload"'))->shouldBeCalled(); $this->save($job, $exception, $worker); }
/** * {@inheritDoc} */ public function stop(JobInterface $job) { $this->redis->del($this->getRedisKey($job)); }
function it_can_count_pushed_jobs(RedisClientInterface $redis, QueueInterface $queue) { $queue->getName()->shouldBeCalled()->willReturn('foo'); $redis->llen('queue:foo')->shouldBeCalled()->willReturn(2); $this->count($queue)->shouldReturn(2); }
/** * {@inheritDoc} */ public function all() { return $this->redis->smembers('queues'); }
function it_returns_all_registered_workers(RedisClientInterface $redis) { $redis->smembers('workers')->shouldBeCalled()->willReturn(array('remote:123', 'local:4556')); $this->all()->shouldReturn(array('remote:123', 'local:4556')); }
function it_can_clear_stat(RedisClientInterface $redis) { $redis->del('stat:test')->shouldBeCalled()->willReturn(true); $this->clear('test', 11)->shouldReturn(true); }
function it_disconnects_redis_client(RedisClientInterface $redis) { $redis->disconnect()->shouldBecalled(); $this->disconnectFromRedis(); }