public function testTbz2()
{
$tar = false;
$includePath = explode(PATH_SEPARATOR, get_include_path());
foreach ($includePath as $path) {
if (file_exists($path . DIRECTORY_SEPARATOR . 'Archive' . DIRECTORY_SEPARATOR . 'Tar.php')) {
$tar = true;
}
}
if ($tar && function_exists('bzopen')) {
$a = new Archive(__DIR__ . '/../tmp/test.tar');
$a->addFiles(__DIR__ . '/../tmp');
$a->compress('bz');
$this->assertFileExists(__DIR__ . '/../tmp/test.tar.bz2');
$this->assertGreaterThan(60000, $a->getSize());
if (file_exists(__DIR__ . '/../tmp/test.tar.bz2')) {
unlink(__DIR__ . '/../tmp/test.tar.bz2');
}
unset($a);
$a = new Archive(__DIR__ . '/../tmp/test.tar');
$a->addFiles(__DIR__ . '/../tmp');
$a->compress('tbz2');
$this->assertFileExists(__DIR__ . '/../tmp/test.tbz2');
$this->assertGreaterThan(60000, $a->getSize());
if (file_exists(__DIR__ . '/../tmp/test.tbz2')) {
unlink(__DIR__ . '/../tmp/test.tbz2');
}
unset($a);
$a = new Archive(__DIR__ . '/../tmp/test.tar');
$a->addFiles(__DIR__ . '/../tmp');
$a->compress('tbz');
$this->assertFileExists(__DIR__ . '/../tmp/test.tbz');
$this->assertGreaterThan(60000, $a->getSize());
if (file_exists(__DIR__ . '/../tmp/test.tbz')) {
unlink(__DIR__ . '/../tmp/test.tbz');
}
}
}