mirror of
https://github.com/splitbrain/php-archive.git
synced 2025-01-17 13:38:26 +01:00
added dogfooding test, extract self created archives
This commit is contained in:
parent
c2490eaadc
commit
c075304b44
@ -158,7 +158,8 @@ class Tar_TestCase extends PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* Create an archive and unpack it again
|
||||
*/
|
||||
public function test_dogfood() {
|
||||
public function test_dogfood()
|
||||
{
|
||||
foreach ($this->extensions as $ext) {
|
||||
$input = glob(dirname(__FILE__) . '/../src/*');
|
||||
$archive = sys_get_temp_dir() . '/dwtartest' . md5(time()) . '.' . $ext;
|
||||
|
@ -118,6 +118,38 @@ class Zip_TestCase extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(13, $content[4]->getSize(), "Contents of $file");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an archive and unpack it again
|
||||
*/
|
||||
public function test_dogfood()
|
||||
{
|
||||
|
||||
$input = glob(dirname(__FILE__) . '/../src/*');
|
||||
$archive = sys_get_temp_dir() . '/dwziptest' . md5(time()) . '.zip';
|
||||
$extract = sys_get_temp_dir() . '/dwziptest' . md5(time() + 1);
|
||||
|
||||
$zip = new Zip();
|
||||
$zip->create($archive);
|
||||
foreach($input as $path) {
|
||||
$file = basename($path);
|
||||
$zip->addFile($path, $file);
|
||||
}
|
||||
$zip->close();
|
||||
$this->assertFileExists($archive);
|
||||
|
||||
$zip = new Zip();
|
||||
$zip->open($archive);
|
||||
$zip->extract($extract, '', '/FileInfo\\.php/', '/.*\\.php/');
|
||||
|
||||
$this->assertFileExists("$extract/Tar.php");
|
||||
$this->assertFileExists("$extract/Zip.php");
|
||||
$this->assertFileNotExists("$extract/FileInfo.php");
|
||||
|
||||
self::rdelete($extract);
|
||||
unlink($archive);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the prebuilt zip files
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user