/**
  * @test
  */
 public function arePhantomjsOptionsHandled()
 {
     $url = $this->configHelper->getOutputFileUrl('e4e5k2');
     $this->configHelper->setConfig(array_merge_recursive($this->config, array('phantomjs' => array('options' => array('--ignore-ssl-errors' => true)))));
     $process = $this->configHelper->buildProcess($url, 'e4e5k2');
     $this->assertContains(ProcessUtils::escapeArgument(sprintf('%s=%s', '--ignore-ssl-errors', 'true')), $process->getCommandLine());
     $this->configHelper->setConfig(array_merge_recursive($this->config, array('phantomjs' => array('options' => array('--ignore-ssl-errors=true')))));
     $process = $this->configHelper->buildProcess($url, 'e4e5k2');
     $command = $process->getCommandLine();
     $this->assertContains(ProcessUtils::escapeArgument('--ignore-ssl-errors=true'), $process->getCommandLine());
     $this->assertNotContains('0', $command);
 }
示例#2
0
 /**
  * @param string $html
  * @param array  $arguments
  * @param string $uniqueId
  *
  * @return string
  */
 public function rasterize($html, $arguments = array(), $uniqueId = "")
 {
     if ($uniqueId === "") {
         $uniqueId = uniqid("rasterize-");
     }
     if ($this->stopwatch instanceof Stopwatch) {
         $this->stopwatch->start($uniqueId);
     }
     $input = $this->configHelper->getInputFilePath($uniqueId);
     $fh = fopen($input, 'w');
     fwrite($fh, $html);
     fclose($fh);
     $output = $this->rasterizeUrl($this->configHelper->getOutputFileUrl($uniqueId), $arguments, $uniqueId);
     unlink($input);
     return $output;
 }