mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-22 00:11:53 +00:00
Added test for blpop
This commit is contained in:
parent
5687c8fe82
commit
ff0d2bc655
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user