/** * @todo need to sort out encoding. This only hard because of the date('c') calls with RedisWorkerRegistryAdapter. */ function it_correctly_saves_a_workers_current_job_to_redis(RedisClientInterface $redis, WorkerInterface $worker, JobInterface $job) { $worker->getId()->shouldBeCalled()->willReturn('foo:333'); $worker->getCurrentJob()->shouldBeCalled()->willReturn($job); $job->encode()->shouldBeCalled()->willReturn('encoded-job'); $redis->sadd('workers', 'foo:333')->shouldBeCalled(); $redis->set('worker:foo:333:started', Argument::any())->shouldBeCalled(); $redis->set('worker:foo:333', Argument::any())->shouldBeCalled(); $this->save($worker); }
function it_saves_queues_to_redis(QueueInterface $queue, RedisClientInterface $redis) { $queue->getName()->shouldBeCalled()->willReturn('high'); $redis->sadd('queues', 'high')->shouldBeCalled(); $this->save($queue); }
/** * {@inheritDoc} */ public function save(QueueInterface $queue) { $this->redis->sadd('queues', $queue->getName()); return $this; }