コード例 #1
0
ファイル: WorkerTest.php プロジェクト: php-resque/resque
 public function testForkingCanBeDisabled()
 {
     $job = new Job('Resque\\Component\\Job\\Tests\\Jobs\\Simple');
     $this->worker = $this->getMock('Resque\\Component\\Worker\\Worker', array('perform', 'reserve'), array($this->getMock('Resque\\Component\\Job\\Factory\\JobInstanceFactoryInterface'), $this->getMock('Resque\\Component\\Core\\Event\\EventDispatcherInterface')));
     $this->worker->expects($this->at(0))->method('reserve')->will($this->returnValue($job));
     $this->worker->expects($this->at(1))->method('perform')->will($this->returnValue(null));
     $this->worker->expects($this->at(2))->method('reserve')->will($this->returnValue(null));
     $this->worker->setForkOnPerform(false);
     $this->worker->work(0);
     // This test fails if the worker forks, as perform is not marked as called in the parent
 }