本文整理汇总了PHP中Kernel::getInstalledModules方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::getInstalledModules方法的具体用法?PHP Kernel::getInstalledModules怎么用?PHP Kernel::getInstalledModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kernel
的用法示例。
在下文中一共展示了Kernel::getInstalledModules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$tab_test = KernelTest::askForDependencies('core/', 'modules/dbi/', 'DBI');
$t->is($tab_test, null, 'TEST OF: Kernel::askForDependencies method for the dbi module');
$tab_test = KernelTest::askForDependencies('core/', 'modules/ihm/', 'ihm ');
$t->is($tab_test, null, 'TEST OF: Kernel::askForDependencies method for the ihm module');
$tab_test = KernelTest::askForDependencies('mgmt/', 'modules/act/', '--act');
$t->is($tab_test, null, 'TEST OF: Kernel::askForDependencies method for the act module');
$tab_test = KernelTest::askForDependencies('mgmt/', 'modules/moderator/', 'modera()tor');
$t->is($tab_test, null, 'TEST OF: Kernel::askForDependencies method for the moderator module');
$tab_test = KernelTest::askForDependencies('mgmt/', 'modules/user/', 'use56r');
$t->is($tab_test, null, 'TEST OF: Kernel::askForDependencies method for the user module');
$tab_test = KernelTest::askForDependencies('mgmt/', 'modules/struct/', 'struct _8');
$t->is($tab_test, null, 'TEST OF: Kernel::askForDependencies method for the struct module');
/*-------------------------------------------F20501---------------------------------------------------------*/
/*F20501-T02*/
Kernel::initialize('');
$t->is(Kernel::getInstalledModules(), null, 'TEST OF: Kernel::initialize method with wrong path.');
$t->isnt(Kernel::getErrors(), null, 'TEST OF: Getting errors after Kernel::initialize method with wrong path.');
/*--------------------------------------------F20503--------------------------------------------------------*/
/*F20503-T01*/
Kernel::buildInstalledModules();
$t->isnt(Kernel::getErrors(), null, 'TEST OF: Instanciating modules without initializing kernel and dependencies table.');
/*F20503-T02*/
Kernel::initialize(dirname(__FILE__) . '/../../apps/');
$modules = Kernel::buildInstalledModules();
$t->is(Kernel::getErrors(), null, 'TEST OF: Instanciating modules with initializing kernel but without initializing dependencies table.');
$t->is($modules, false, 'TEST OF: Instanciating modules with initializing kernel but without initializing dependencies table.');
/*F20503-T03*/
Kernel::initialize(dirname(__FILE__) . '/../../apps/');
Kernel::buildDependenciesTable();
$modules = Kernel::buildInstalledModules();
$t->is(Kernel::getErrors(), null, 'TEST OF: Instanciating modules with initializing kernel and dependencies table.');
示例2: buildDependenciesTable
/**
* This method is charged to build the dependencies table of the application.
* The dependencies table is an array, indexed by the modules names, of arrays
* of the other modules which are necessary to the first.
*/
public static function buildDependenciesTable()
{
$table = array();
if (is_null($installed_apps = Kernel::getInstalledModules())) {
return null;
}
foreach ($installed_apps as $app_path => $modules) {
foreach ($modules as $module_name => $module_path) {
if (!is_null($dep = self::askForDependencies($app_path, $module_path, $module_name))) {
$table[$module_name] = $dep;
}
}
}
parent::setDependenciesTable($table);
}
示例3: isInstalled
/**
* This method checks whether a module is installed or not.
* @param $module_name: a string that represents the name of the module.
*/
public static function isInstalled($module)
{
$table = Kernel::getInstalledModules();
foreach ($table as $app_name => $modules) {
foreach ($modules as $module_name => $module_path) {
if ($module_name == $module) {
return true;
}
}
}
return false;
}