From e541fa9b70c944b9a7f90fc636531db6c88c2e54 Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Tue, 12 Mar 2013 09:55:03 +0100 Subject: [PATCH] Added test for blpop --- test/Resque/Tests/WorkerTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/Resque/Tests/WorkerTest.php b/test/Resque/Tests/WorkerTest.php index b2f0e00..b0001c9 100644 --- a/test/Resque/Tests/WorkerTest.php +++ b/test/Resque/Tests/WorkerTest.php @@ -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); + } } \ No newline at end of file