public function testDefaultOptions() { $options = new Options(); $actualOptionArray = $options->toArray(); $expectedOptionArray = ['format' => 'A4', 'orientation' => 'portrait', 'zoomFactor' => 1]; $this->assertEquals($expectedOptionArray, $actualOptionArray); }
/** * @param string $resourcePath * @param string $targetPath * @param \PhantomPdf\Options $options * * @return string */ protected function createCommand($resourcePath, $targetPath, Options $options) { $commandLineOptions = implode(' ', $this->commandLineOptions); $optionArray = $options->toArray(); $encodedOptions = escapeshellarg(json_encode($optionArray)); $commandSegments = []; $commandSegments[] = $this->binaryPath; $commandSegments[] = $commandLineOptions; $commandSegments[] = __DIR__ . '/../js/phantom-pdf.js'; $commandSegments[] = $resourcePath; $commandSegments[] = $targetPath; $commandSegments[] = $encodedOptions; return implode(' ', $commandSegments); }