Exemple #1
0
 public function testExtractTo()
 {
     $archiveFileName = $this->getTempFileName();
     $archive = new ZipArchive($archiveFileName);
     $entry = new PharEntry();
     $entry->setName('foo');
     $entry->setContent('23');
     $entry->setMetaData(array('Content-Type' => 'text/plain'));
     $archive->addEntry($entry);
     $entry = new PharEntry();
     $entry->setName('bar');
     $entry->setContent('42');
     $archive->addEntry($entry);
     $archive->flush();
     $target = $this->getTempExtractDir();
     $archive = new ZipArchive($archiveFileName);
     $archive->extractTo($target);
     $this->assertStringEqualsFile($target . '/foo', '23');
     $this->assertStringEqualsFile($target . '/bar', '42');
 }
Exemple #2
0
 /**
  * @param $localName
  *
  * @return \Blar\Archive\PharEntry
  */
 public function getEntry($localName)
 {
     $pharFileInfo = $this->getHandle()->offsetGet($localName);
     $entry = new PharEntry();
     $entry->setPharFileInfo($pharFileInfo);
     return $entry;
 }