Пример #1
0
 function testGetRequiredModules()
 {
     ModuleUtils::set_modules_path(FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/");
     $def = AvailableModules::get_available_module_definition("ecommerce", "cart");
     $required_modules = $def->get_required_modules();
     $this->assertEqual(2, count($required_modules), "Il numero di moduli richiesti non corrisponde!!");
     $k = array_keys($required_modules);
     $this->assertEqual($k[0], "ecommerce/base", "Il modulo richiesto 0 non corrisponde!!");
     $this->assertEqual($k[1], "ecommerce/forms", "Il modulo richiesto 1 non corrisponde!!");
 }
Пример #2
0
 function execute_action()
 {
     $nome_categoria = Params::get("nome_categoria");
     $nome_modulo = Params::get("nome_modulo");
     $command = Params::get("command");
     if ($command != "install" && $command != "uninstall" && $command != null) {
         $def = AvailableModules::get_available_module_definition($nome_categoria, $nome_modulo);
         $action_data = $def->get_action_data($command);
         $plug = ModuleUtils::getModulePlug($nome_categoria, $nome_modulo);
         $plug->execute($action_data);
         Flash::ok("Azione '" . $command . "' eseguita con successo.");
         return Redirect::success();
     } else {
         return Redirect::failure();
     }
 }
Пример #3
0
 static function save_as_archive($category_name, $module_name)
 {
     if (!AvailableModules::is_module_available($category_name, $module_name)) {
         throw new IllegalStateException("Il modulo " . $category_name . "/" . $module_name . "non risulta disponibile!!");
     }
     $d = new Dir(self::MODULES_ARCHIVE_DIR);
     $d->touch();
     $spec = AvailableModules::get_available_module_definition($category_name, $module_name);
     $category_name = $spec->get_category_name();
     $module_name = $spec->get_module_name();
     $version = $spec->get_current_version();
     $v = $version["major_version"] . "_" . $version["minor_version"] . "_" . $version["revision"];
     $archive_dir = new Dir(self::MODULES_ARCHIVE_DIR);
     $archive_dir->touch();
     $source_dir = new Dir(ModuleUtils::get_modules_path() . "/" . $category_name . "/" . $module_name . "/");
     $target_file = $archive_dir->newFile($category_name . "__" . $module_name . "-" . $v . ".ffa");
     $properties = array();
     $properties["category_name"] = $category_name;
     $properties["module_name"] = $module_name;
     $properties["major_version"] = $version["major_version"];
     $properties["minor_version"] = $version["minor_version"];
     $properties["revision"] = $version["revision"];
     return FFArchive::compress($target_file, $source_dir, $properties);
 }
Пример #4
0
 function testDropView()
 {
     ModuleUtils::set_modules_path(FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/");
     $db_desc = DB::newDatabaseDescription();
     $this->assertFalse($db_desc->hasTable("vendite_full"), "La vista vendite_full esiste gia'!!");
     DB::newDirectSql($this->create_for_view)->exec();
     DB::newDirectSql($this->create_view)->exec();
     $db_desc = DB::newDatabaseDescription();
     $this->assertTrue($db_desc->hasTable("vendite_full"), "La vista vendite_full non e' stata creata!!");
     $plug = new ModulePlug(new Dir("/" . FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/ecommerce/cart/"));
     $def = AvailableModules::get_available_module_definition("ecommerce", "cart");
     $drop_view = $def->get_action_data("drop_view");
     $plug->execute($drop_view);
     $db_desc = DB::newDatabaseDescription();
     $this->assertFalse($db_desc->hasTable("vendite_full"), "La vista vendite_full non e' stata rimossa!!");
     DB::newDirectSql($this->drop_for_view)->exec();
 }
Пример #5
0
 function testDescription()
 {
     ModuleUtils::set_modules_path(FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/");
     $def = AvailableModules::get_available_module_definition("ecommerce", "cart");
     $this->assertEqual($def->get_description(), "Modulo ecommerce cart di test.", "La descrizione del modulo non corrisponde!!");
 }