/** * {@inheritDoc} */ public function dequeue() { $job = $this->storage->dequeue($this); if (!$job) { return null; } if ($job instanceof OriginQueueAwareInterface) { $job->setOriginQueue($this); } $this->eventDispatcher->dispatch(ResqueQueueEvents::JOB_POPPED, new QueueJobEvent($this, $job)); return $job; }
function it_dequeues_a_job(QueueStorageInterface $storage, EventDispatcherInterface $eventDispatcher, JobInterface $job) { $storage->dequeue($this)->shouldBeCalled()->willReturn($job); $eventDispatcher->dispatch(ResqueQueueEvents::JOB_POPPED, Argument::type('Resque\\Component\\Queue\\Event\\QueueJobEvent')); $this->dequeue()->shouldReturn($job); }