public function getCurrentJob() { $job = $this->worker->job(); if (!$job) { return null; } $job = new \Resque_Job($job['queue'], $job['payload']); return $job->getInstance(); }
public function testWorkerRecordsWhatItIsWorkingOn() { $worker = new Resque_Worker('jobs'); $worker->setLogger(new Resque_Log()); $worker->registerWorker(); $payload = array('class' => 'Test_Job'); $job = new Resque_Job('jobs', $payload); $worker->workingOn($job); $job = $worker->job(); $this->assertEquals('jobs', $job['queue']); if (!isset($job['run_at'])) { $this->fail('Job does not have run_at time'); } $this->assertEquals($payload, $job['payload']); }