/** * @Then /^The package can be downloaded to system\'s tmp dir$/ */ public function thePackageCanBeDownloadedToSystemSTmpDir() { $this->dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-doc-parser-test'; @mkdir($this->dir); $file = $this->dir . DIRECTORY_SEPARATOR . $this->package->getOrigFilename(); $this->package->download($file); }
/** * @Then /^download manual from "([^"]*)" package from "([^"]*)"$/ */ public function downloadManualFromPackageFrom($lang, $mirror) { $this->package = new Package($lang, $mirror); $dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'php-doc-parser-test'; @mkdir($dir); $file = $dir . DIRECTORY_SEPARATOR . $this->package->getOrigFilename(); $this->package->download($file); $testUnpackDir = $this->package->unpack(array_map(function ($item) { return $item['source-filename']; }, $this->testFiles)); $this->unpackedFilesDir = $this->package->getUnpackedDir(); assertEquals($testUnpackDir, $this->unpackedFilesDir); assertCount(count($this->testFiles), glob($this->unpackedFilesDir . DIRECTORY_SEPARATOR . '*.html')); }
public function unpackPackage(Package $package) { $this->output->writeln('Unpacking <comment>' . $package->getOrigFilename() . '</comment> ...'); $manualDir = $package->unpack(); $this->output->writeln('Unpacked to <comment>' . $manualDir . "</comment>\n"); return $manualDir; }