本文整理汇总了PHP中AgaviConfig::fromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP AgaviConfig::fromArray方法的具体用法?PHP AgaviConfig::fromArray怎么用?PHP AgaviConfig::fromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AgaviConfig
的用法示例。
在下文中一共展示了AgaviConfig::fromArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFromArrayMergesButDoesNotOverwriteReadonlies
public function testFromArrayMergesButDoesNotOverwriteReadonlies()
{
$data = array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'qux');
AgaviConfig::clear();
AgaviConfig::set('baz', 'lol', true, true);
AgaviConfig::fromArray($data);
$this->assertEquals(array('baz' => 'lol') + $data, AgaviConfig::toArray());
}
示例2: initializeModule
/**
* Initialize a module and load its autoload, module config etc.
*
* @param string The name of the module to initialize.
*
* @author Felix Gilcher <felix.gilcher@bitextender.com>
* @since 1.0.0
*/
public function initializeModule($moduleName)
{
$lowerModuleName = strtolower($moduleName);
if (null === AgaviConfig::get('modules.' . $lowerModuleName . '.enabled')) {
// set some defaults first
AgaviConfig::fromArray(array('modules.' . $lowerModuleName . '.agavi.action.path' => '%core.module_dir%/${moduleName}/actions/${actionName}Action.class.php', 'modules.' . $lowerModuleName . '.agavi.cache.path' => '%core.module_dir%/${moduleName}/cache/${actionName}.xml', 'modules.' . $lowerModuleName . '.agavi.template.directory' => '%core.module_dir%/${module}/templates', 'modules.' . $lowerModuleName . '.agavi.validate.path' => '%core.module_dir%/${moduleName}/validate/${actionName}.xml', 'modules.' . $lowerModuleName . '.agavi.view.path' => '%core.module_dir%/${moduleName}/views/${viewName}View.class.php', 'modules.' . $lowerModuleName . '.agavi.view.name' => '${actionName}${viewName}'));
// include the module configuration
// loaded only once due to the way load() (former import()) works
if (is_readable(AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/config/module.xml')) {
include_once AgaviConfigCache::checkConfig(AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/config/module.xml');
} else {
AgaviConfig::set('modules.' . $lowerModuleName . '.enabled', true);
}
$moduleAutoload = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/config/autoload.xml';
if (is_readable($moduleAutoload)) {
AgaviConfigCache::load($moduleAutoload);
}
if (AgaviConfig::get('modules.' . $lowerModuleName . '.enabled')) {
$moduleConfigHandlers = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/config/config_handlers.xml';
if (is_readable($moduleConfigHandlers)) {
AgaviConfigCache::addConfigHandlersFile($moduleConfigHandlers);
}
}
}
if (!AgaviConfig::get('modules.' . $lowerModuleName . '.enabled')) {
throw new AgaviDisabledModuleException(sprintf('The module "%1$s" is disabled.', $moduleName));
}
// check for a module config.php
$moduleConfig = AgaviConfig::get('core.module_dir') . '/' . $moduleName . '/config.php';
if (is_readable($moduleConfig)) {
require_once $moduleConfig;
}
}
示例3: unset
<?php
$agaviTestSettings = $GLOBALS['AGAVI_TESTING_ISOLATED_TEST_SETTINGS'];
unset($GLOBALS['AGAVI_TESTING_ISOLATED_TEST_SETTINGS']);
if ($agaviTestSettings['bootstrap'] || $agaviTestSettings['clearCache']) {
require __DIR__ . '/../../testing.php';
}
if ($agaviTestSettings['bootstrap']) {
// when agavi is not bootstrapped we don't want / need to load the agavi config
// values from outside the isolation
AgaviConfig::fromArray($GLOBALS['AGAVI_TESTING_CONFIG']);
}
unset($GLOBALS['AGAVI_TESTING_CONFIG']);
if ($agaviTestSettings['clearCache']) {
AgaviToolkit::clearCache();
}
$env = null;
if ($agaviTestSettings['environment']) {
$env = $agaviTestSettings['environment'];
}
if ($agaviTestSettings['bootstrap']) {
AgaviTesting::bootstrap($env);
}
if ($agaviTestSettings['defaultContext']) {
AgaviConfig::set('core.default_context', $agaviTestSettings['defaultContext']);
}
if (!defined('AGAVI_TESTING_BOOTSTRAPPED')) {
// when PHPUnit runs with preserve global state enabled, AGAVI_TESTING_BOOTSTRAPPED will already be defined
define('AGAVI_TESTING_BOOTSTRAPPED', true);
}
if (AGAVI_TESTING_ORIGINAL_PHPUNIT_BOOTSTRAP) {
示例4: tearDown
public function tearDown()
{
AgaviConfig::clear();
AgaviConfig::fromArray($this->conf);
}