Added test for blpop

This commit is contained in:
Ruud Kamphuis 2013-03-12 09:55:03 +01:00
parent 15324ca410
commit e541fa9b70

View File

@ -247,4 +247,27 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase
$this->assertEquals(1, Resque_Stat::get('failed')); $this->assertEquals(1, Resque_Stat::get('failed'));
} }
public function testBlockingListPop()
{
$worker = new Resque_Worker('jobs');
$worker->registerWorker();
Resque::enqueue('jobs', 'Test_Job_1');
Resque::enqueue('jobs', 'Test_Job_2');
$i = 1;
while($job = $worker->reserve(60))
{
$this->assertEquals('Test_Job_' . $i, $job->payload['class']);
if($i == 2) {
break;
}
$i++;
}
$this->assertEquals(2, $i);
}
} }