Exemplo n.º 1
0
 public function testPoolSpawnTooManyWorkers()
 {
     $pool = new Pool(5);
     $pool->setOutput(new NullOutput());
     $command = new Command('echo foo');
     $process = new Process($command);
     $worker = new Worker($process);
     // Nullify the output
     $process->setOutput(new NullOutput());
     $worker->setOutput(new NullOutput());
     $pool->setWorkerInstance($worker);
     $this->assertEquals(0, count($pool->getWorkers()));
     $this->setExpectedException('\\Exception');
     for ($i = 0; $i < 6; $i++) {
         $pool->spawn();
         $this->assertEquals($i + 1, count($pool->getWorkers()));
     }
 }
Exemplo n.º 2
0
 public function setUp()
 {
     $this->command = new Command('php Fixtures/foo.php');
     $this->process = new Process($this->command);
     $this->process->setOutput(new NullOutput());
 }