/**
  * @Given /^Unpack files to the same directory:$/
  */
 public function unpackFilesToTheSameDirectory(PyStringNode $string)
 {
     $expectedFiles = $string->getLines();
     $this->pagesDir = $this->package->unpack($expectedFiles);
     assertFileExists($this->pagesDir);
     chdir($this->pagesDir);
     $foundFiles = array_flip(glob('*.html'));
     assertCount(count($expectedFiles), $foundFiles);
     foreach ($expectedFiles as $file) {
         assertArrayHasKey($file, $foundFiles);
     }
 }
 /**
  * @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;
 }