Esempio n. 1
0
 /**
  * @param string $destinationFile
  * @param string $extensionRequired
  * @dataProvider tarProvider
  */
 public function testPackUnpackTar($destinationFile, $extensionRequired)
 {
     if ($extensionRequired && !extension_loaded($extensionRequired)) {
         $this->markTestSkipped("The extension '{$extensionRequired}' is not enabled.");
     }
     $this->packed = $this->archive->pack($this->sourceFilePath, $this->destinationDir . $destinationFile);
     $this->assertFileExists($this->packed);
     $this->assertEquals($this->destinationDir . $destinationFile, $this->packed);
     $unpacked = $this->archive->unpack($this->packed, $this->destinationDir);
     $this->unpacked = $unpacked . pathinfo($this->sourceFilePath, PATHINFO_BASENAME);
     $this->assertFileExists($this->unpacked);
     $this->assertStringStartsWith($this->destinationDir, $this->unpacked);
 }
Esempio n. 2
0
$dirOut = __DIR__ . DIRECTORY_SEPARATOR . 'out';
$fileArchive = __DIR__ . DIRECTORY_SEPARATOR . 'archive';
?>
<!DOCTYPE html>
<html lang="ru">
    <head><meta charset="utf-8"></head>
	<body>
		<?php 
if (Archive::pack($dirIn, $fileArchive)) {
    ?>
			Создан архив <b><?php 
    echo $fileArchive;
    ?>
<br/></b>
		<?php 
}
?>
		<?php 
if (Archive::unpack($dirOut, $fileArchive)) {
    ?>
			И успешно распакован в директорию <b><?php 
    echo $dirOut;
    ?>
</b>
		<?php 
}
?>
	
	</body>
</html>