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:
Chris Boulton 2010-08-01 15:23:41 +10:00
parent 5dc24ebbe4
commit 5f64653149
5 changed files with 33 additions and 33 deletions

View file

@ -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);
}
}

View file

@ -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;
}
}