/** * In nearly all cases, the additional info is rendered left to the action-icons. * * @return string */ public function getStrAdditionalInfo() { $strReturn = ""; if ($this->objMetadata == null) { return ""; } if ($this->objMetadata->getStrVersion() != "") { $strReturn .= $this->getLang("pack_version") . " " . $this->objMetadata->getStrVersion(); } if ($this->objMetadata->getStrAuthor() != "") { $strReturn .= " " . $this->getLang("pack_author") . " " . $this->objMetadata->getStrAuthor(); } return $strReturn; }
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"); }