public function testCompressFolder()
 {
     $files = array('releases-noNewPatch.xml', 'releases-patchsOnly.xml', 'releases.xml', 'folder/', 'folder/emptyFile', 'emptyFolder/');
     $dest = dirname(__FILE__) . '/backup/test.zip';
     $src = dirname(__FILE__) . '/sample';
     taoUpdate_helpers_Zip::compressFolder($src, $dest);
     $this->assertTrue(is_file($dest));
     $zip = new ZipArchive();
     $zip->open($dest);
     foreach ($files as $file) {
         $this->assertFalse($zip->locateName($file) === false, $file . ' not found');
     }
     $this->assertFalse($zip->locateName('.svn'));
     helpers_File::remove($dest);
     $dest = dirname(__FILE__) . '/backup/test2.zip';
     taoUpdate_helpers_Zip::compressFolder($src, $dest, true);
     $files = array('sample/releases-noNewPatch.xml', 'sample/releases-patchsOnly.xml', 'sample/releases.xml', 'sample/folder/', 'sample/folder/emptyFile', 'sample/emptyFolder/');
     $this->assertTrue(is_file($dest));
     $zip = new ZipArchive();
     $zip->open($dest);
     for ($i = 0; $i < $zip->numFiles; $i++) {
         $stat = $zip->statIndex($i);
         //cehck no .svn added in zip
         $this->assertFalse(strpos($stat['name'], '.svn') > 0);
     }
     foreach ($files as $file) {
         $this->assertFalse($zip->locateName($file) === false);
     }
     helpers_File::remove($dest);
 }
 /**
  * 
  * @access
  * @author "Lionel Lecaque, <*****@*****.**>"
  * @param unknown $folder
  * @throws taoUpdate_models_classes_UpdateException
  */
 public function storeDatabase($folder)
 {
     $dbBackupHelper = new taoUpdate_helpers_DbBackup();
     $fileContent = $dbBackupHelper->backup();
     $filepath = $folder . DIRECTORY_SEPARATOR . self::DB_BACKUP_FILE_PREFFIX . TAO_VERSION . self::DB_BACKUP_FILE_SUFFIX;
     if (!file_put_contents($filepath, $fileContent)) {
         throw new taoUpdate_models_classes_UpdateException('fail to create SQL file');
     }
     if (is_file($filepath)) {
         taoUpdate_helpers_Zip::compressFile($filepath, $filepath . '.zip');
         if (is_file($filepath . '.zip')) {
             helpers_File::remove($filepath);
         }
     }
 }
 /**
  *
  * @access public
  * @author "Lionel Lecaque, <*****@*****.**>"
  * @param string $file
  */
 public function extractRelease($file, $dest)
 {
     return taoUpdate_helpers_Zip::extractFile($file, $dest);
 }