public function testExtractAndMove()
 {
     $objFilesystem = new class_filesystem();
     $objFilesystem->folderCreate(_projectpath_ . "/temp/moduletest");
     file_put_contents(_realpath_ . _projectpath_ . "/temp/moduletest/metadata.xml", $this->getStrMetadata());
     $objFilesystem->folderCreate(_projectpath_ . "/temp/moduletest/system");
     file_put_contents(_realpath_ . _projectpath_ . "/temp/moduletest/system/test.txt", $this->getStrMetadata());
     $objZip = new class_zip();
     $objZip->openArchiveForWriting(_projectpath_ . "/temp/autotest.zip");
     $objZip->addFile(_projectpath_ . "/temp/moduletest/metadata.xml", "/metadata.xml");
     $objZip->addFile(_projectpath_ . "/temp/moduletest/system/test.txt", "/system/test.txt");
     $objZip->closeArchive();
     $objFilesystem->folderDeleteRecursive(_projectpath_ . "/temp/moduletest/");
     $objManager = new class_module_packagemanager_manager();
     $objPackageManager = $objManager->getPackageManagerForPath(_projectpath_ . "/temp/autotest.zip");
     $this->assertEquals(get_class($objPackageManager), "class_module_packagemanager_packagemanager_module");
     $objPackageManager = $objManager->extractPackage(_projectpath_ . "/temp/autotest.zip");
     $this->assertEquals(get_class($objPackageManager), "class_module_packagemanager_packagemanager_module");
     $objPackageManager->move2Filesystem();
     $this->assertFileExists(_realpath_ . "/core/module_autotest/metadata.xml");
     $this->assertFileExists(_realpath_ . "/core/module_autotest/system/test.txt");
     $objMetadata = new class_module_packagemanager_metadata();
     $objMetadata->autoInit("/core/module_autotest/");
     $this->assertEquals("Autotest", $objMetadata->getStrTitle());
     $this->assertEquals("", $objMetadata->getStrDescription());
     $this->assertEquals("3.9.1", $objMetadata->getStrVersion());
     $this->assertEquals("Kajona Team", $objMetadata->getStrAuthor());
     $this->assertEquals("module_autotest", $objMetadata->getStrTarget());
     $this->assertEquals(class_module_packagemanager_manager::STR_TYPE_MODULE, $objMetadata->getStrType());
     $this->assertEquals(false, $objMetadata->getBitProvidesInstaller());
     $arrRequired = $objMetadata->getArrRequiredModules();
     $arrModules = array_keys($arrRequired);
     $arrVersion = array_values($arrRequired);
     $this->assertEquals("system", $arrModules[0]);
     $this->assertEquals("3.4.1", $arrVersion[0]);
     $this->assertEquals("pages", $arrModules[1]);
     $this->assertEquals("3.4.2", $arrVersion[1]);
     $arrImages = $objMetadata->getArrScreenshots();
     $this->assertEquals(1, count($arrImages));
     $this->assertEquals("/test.jpg", $arrImages[0]);
     $objFilesystem->folderDeleteRecursive("/core/module_autotest");
     $objFilesystem->fileDelete(_projectpath_ . "/temp/autotest.zip");
 }
 /**
  * Validates, whether the current package is installable or not.
  * In nearly all cases
  *
  * @return bool
  */
 public function isInstallable()
 {
     if (!$this->getObjMetadata()->getBitProvidesInstaller()) {
         return false;
     }
     //check if required modules are given in matching versions
     $arrRequiredModules = $this->objMetadata->getArrRequiredModules();
     foreach ($arrRequiredModules as $strOneModule => $strMinVersion) {
         if (trim($strOneModule) != "") {
             $objModule = class_module_system_module::getModuleByName(trim($strOneModule));
             if ($objModule === null) {
                 $arrModules = class_resourceloader::getInstance()->getArrModules();
                 $objMetadata = null;
                 foreach ($arrModules as $strPath => $strOneFolder) {
                     if (uniStrpos($strOneFolder, $strOneModule) !== false) {
                         $objMetadata = new class_module_packagemanager_metadata();
                         $objMetadata->autoInit("/" . $strPath);
                         //but: if the package provides an installer and was not resolved by the previous calls,
                         //we shouldn't include it here
                         if ($objMetadata->getBitProvidesInstaller()) {
                             $objMetadata = null;
                         }
                     }
                 }
                 //no package found
                 if ($objMetadata === null) {
                     return false;
                 }
                 //package found, but wrong version
                 if (version_compare($strMinVersion, $objMetadata->getStrVersion(), ">")) {
                     return false;
                 }
             } else {
                 if (version_compare($strMinVersion, $objModule->getStrVersion(), ">")) {
                     return false;
                 }
             }
         }
     }
     //compare versions of installed elements
     $objModule = class_module_system_module::getModuleByName($this->getObjMetadata()->getStrTitle());
     if ($objModule !== null) {
         if (version_compare($this->objMetadata->getStrVersion(), $objModule->getStrVersion(), ">")) {
             return true;
         } else {
             return false;
         }
     } else {
         return true;
     }
 }