mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-21 16:01:53 +00:00
Added test for blpop
This commit is contained in:
parent
15324ca410
commit
e541fa9b70
@ -247,4 +247,27 @@ class Resque_Tests_WorkerTest extends Resque_Tests_TestCase
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user