Пример #1
0
 /**
  * Create process builder.
  *
  * @param array $arguments
  * @param Input $input
  *
  * @return ProcessBuilder
  */
 protected function createProcessBuilder(array $arguments, Input $input)
 {
     $processBuilder = ProcessBuilder::create($arguments);
     $processBuilder->setPrefix($this->ghostscript->getOption('bin', Ghostscript::DEFAULT_BINARY));
     $processBuilder->setWorkingDirectory($this->ghostscript->getOption('cwd'));
     $processBuilder->addEnvironmentVariables($this->ghostscript->getOption('env', []));
     $processBuilder->setTimeout($this->ghostscript->getOption('timeout', 60));
     $processBuilder->setInput($input->getProcessInput());
     return $processBuilder;
 }
Пример #2
0
 public function testPdfDeviceCreation()
 {
     $instance = new Ghostscript();
     $this->assertInstanceOf('GravityMedia\\Ghostscript\\Device\\PdfWrite', $instance->createPdfDevice('/path/to/output/file.pdf'));
 }
Пример #3
0
 /**
  * @dataProvider provideTimeout
  *
  * @param null|int $value
  * @param null|int $result
  */
 public function testTimeoutOption($value, $result)
 {
     $instance = new Ghostscript(['timeout' => $value]);
     $device = $instance->createPdfDevice('/path/to/output/file.pdf');
     $process = $device->createProcess(__DIR__ . '/../data/input.pdf');
     $this->assertEquals($result, $process->getTimeout());
 }