Ejemplo 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()));
     }
 }
Ejemplo n.º 2
0
 public function testGetOutput()
 {
     $this->assertInstanceOf('Nyx\\NullOutput', $this->process->getOutput());
     $process = new Process($this->command);
     $this->assertInstanceOf('Nyx\\Console', $process->getOutput());
 }