mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Making it compatible with PHP < 5.5
Making the factory receive the classname
This commit is contained in:
parent
7d2ce1bc8b
commit
de22db6826
3 changed files with 11 additions and 10 deletions
|
@ -365,30 +365,30 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase
|
|||
public function testUseFactoryToGetJobInstance()
|
||||
{
|
||||
$payload = array(
|
||||
'class' => Some_Job_Class::class,
|
||||
'class' => 'Some_Job_Class',
|
||||
'args' => null
|
||||
);
|
||||
$job = new Resque_Job('jobs', $payload);
|
||||
$factory = $this->getMock(Resque_Job_FactoryInterface::class);
|
||||
$factory = $this->getMock('Resque_Job_FactoryInterface');
|
||||
$job->setJobFactory($factory);
|
||||
$testJob = $this->getMock(Resque_JobInterface::class);
|
||||
$testJob = $this->getMock('Resque_JobInterface');
|
||||
$factory->expects(self::once())->method('create')->will($this->returnValue($testJob));
|
||||
$instance = $job->getInstance();
|
||||
$this->assertInstanceOf(Resque_JobInterface::class, $instance);
|
||||
$this->assertInstanceOf('Resque_JobInterface', $instance);
|
||||
}
|
||||
|
||||
public function testDoNotUseFactoryToGetInstance()
|
||||
{
|
||||
$payload = array(
|
||||
'class' => Some_Job_Class::class,
|
||||
'class' => 'Some_Job_Class',
|
||||
'args' => null
|
||||
);
|
||||
$job = new Resque_Job('jobs', $payload);
|
||||
$factory = $this->getMock(Resque_Job_FactoryInterface::class);
|
||||
$testJob = $this->getMock(Resque_JobInterface::class);
|
||||
$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::class, $instance);
|
||||
$this->assertInstanceOf('Resque_JobInterface', $instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue