getInstance() public method

Get the instantiated object for this job that will be performing work.
public getInstance ( ) : Resque_JobInterface
return Resque_JobInterface Instance of the object that this job belongs to.
Ejemplo n.º 1
0
 public function getCurrentJob()
 {
     $job = $this->worker->job();
     if (!$job) {
         return null;
     }
     $job = new \Resque_Job($job['queue'], $job['payload']);
     return $job->getInstance();
 }
Ejemplo n.º 2
0
 public function testDoNotUseFactoryToGetInstance()
 {
     $payload = array('class' => 'Some_Job_Class', 'args' => array(array()));
     $job = new Resque_Job('jobs', $payload);
     $factory = $this->getMock('Resque_Job_FactoryInterface');
     $testJob = $this->getMock('Resque_JobInterface');
     $factory->expects(self::never())->method('create')->will(self::returnValue($testJob));
     $instance = $job->getInstance();
     $this->assertInstanceOf('Resque_JobInterface', $instance);
 }