本文整理汇总了PHP中Worker::processOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Worker::processOne方法的具体用法?PHP Worker::processOne怎么用?PHP Worker::processOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worker
的用法示例。
在下文中一共展示了Worker::processOne方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWorkerNoJobs
/**
* 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);
}