mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Change job classes to be instantiated rather than calling methods statically. This obviously makes it easier for state information to be destroyed after a job runs. This change is NOT backwards compatible and requests job classes be rewritten. Jobs also no longer receive arguments in the perform/setUp/tearDown methods but instead are passed as a $args variable to the instantiated job
This commit is contained in:
parent
5dc24ebbe4
commit
5f64653149
5 changed files with 33 additions and 33 deletions
|
@ -150,7 +150,6 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase
|
|||
$job->perform();
|
||||
|
||||
$this->assertTrue(Test_Job_With_SetUp::$called);
|
||||
$this->assertEquals($payload['args'], Test_Job_With_SetUp::$data);
|
||||
}
|
||||
|
||||
public function testJobWithTearDownCallbackFiresSetUp()
|
||||
|
@ -166,6 +165,5 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase
|
|||
$job->perform();
|
||||
|
||||
$this->assertTrue(Test_Job_With_TearDown::$called);
|
||||
$this->assertEquals($payload['args'], Test_Job_With_TearDown::$data);
|
||||
}
|
||||
}
|
|
@ -118,15 +118,14 @@ class Test_Job_Without_Perform_Method
|
|||
class Test_Job_With_SetUp
|
||||
{
|
||||
public static $called = false;
|
||||
public static $data = false;
|
||||
public $args = false;
|
||||
|
||||
public function setUp($data)
|
||||
public function setUp()
|
||||
{
|
||||
self::$called = true;
|
||||
self::$data = $data;
|
||||
}
|
||||
|
||||
public function perform($data)
|
||||
public function perform()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -136,16 +135,15 @@ class Test_Job_With_SetUp
|
|||
class Test_Job_With_TearDown
|
||||
{
|
||||
public static $called = false;
|
||||
public static $data = false;
|
||||
public $args = false;
|
||||
|
||||
public function perform($data)
|
||||
public function perform()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function tearDown($data)
|
||||
public function tearDown()
|
||||
{
|
||||
self::$called = true;
|
||||
self::$data = $data;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue