Ejemplo n.º 1
0
/**
 * shell_exec() mock to capture invocation parameters for the actual \shell_exec() function
 *
 * @param $command
 * @return string
 */
function shell_exec($command)
{
    $output = ExecRecorder::$execOutput[ExecRecorder::$execCalled];
    ExecRecorder::$execCalled++;
    ExecRecorder::$execCommand = $command;
    return $output;
}
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function extractMetaDataUsesMParameter()
 {
     ExecRecorder::setReturnExecOutput(array('foo'));
     $file = new File(array('identifier' => 'testWORD.doc', 'name' => 'testWORD.doc'), $this->documentsStorageMock);
     $service = new AppService($this->getConfiguration());
     $service->extractMetaData($file);
     $this->assertContains('-m', ExecRecorder::$execCommand);
 }
Ejemplo n.º 3
0
 /**
  * @test
  */
 public function stopStopsProcess()
 {
     $process = new Process('/usr/bin/foo', '-bar');
     $process->setPid(1337);
     ExecRecorder::setReturnExecOutput(array('1337 /usr/bin/foo -bar'));
     $running = $process->isRunning();
     $this->assertTrue($running);
     $stopped = $process->stop();
     $this->assertTrue($stopped);
     $running = $process->isRunning();
     $this->assertFalse($running);
 }