/**
  * When the timeout passed to ::processOne() is 0 and there are no jobs it should return quitely.
  * @throws Exception\WorkerException
  */
 public function testWorkerNoJobs()
 {
     $testWorkerRuns = $this;
     $tube = 'worker_tube_' . rand(53, 504);
     $data = 'worker_value_' . rand(95, 3000);
     $pheanstalk = new Pheanstalk(self::SERVER_HOST, self::SERVER_PORT);
     $worker = new Worker(self::SERVER_HOST, self::SERVER_PORT);
     $worker->register($tube, function (Job $job) use($testWorkerRuns, $data) {
         $testWorkerRuns->assertEquals($data, $job->getData());
     });
     $processedJob = $worker->processOne(0);
     $stats = $pheanstalk->statsTube($tube);
     $this->assertEquals($stats['total-jobs'], 0);
 }
Example #2
0
		public function register(){
			parent::register();
		}