本文整理匯總了PHP中Icinga\Application\Config::configDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::configDir方法的具體用法?PHP Config::configDir怎麽用?PHP Config::configDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Icinga\Application\Config
的用法示例。
在下文中一共展示了Config::configDir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFoo
<?php
use Icinga\Module\Director\Objects\IcingaTimePeriodRange;
use Icinga\Module\Director\Objects\IcingaTimePeriodRanges;
use Icinga\Module\Director\Objects\IcingaTimePeriod;
use Icinga\Test\BaseTestCase;
use Icinga\Application\Config;
use Icinga\Module\Director\Db;
Icinga\Application\Config::$configDir = '/etc/icingaweb2';
/**
* $ icingacli test php unit /usr/local/icingaweb-modules/director
*/
class TimePeriodRangesTest extends BaseTestCase
{
public function testFoo()
{
$this->assertEquals('foo', 'foo');
}
public function getDb()
{
$resourceName = Config::module('director')->get('db', 'resource');
$db = Db::fromResourceName($resourceName);
return $db;
}
public function prepare()
{
$db = $this->getDb();
$object = IcingaTimePeriod::load(1, $db);
$ranges = $object->ranges();
$newRanges = array('monday' => '00:00-24:00', 'tuesday' => '00:00-24:00', 'wednesday' => '00:00-24:00');
$ranges->set($newRanges);
示例2: loadConfig
/**
* Load Configuration
*
* @return $this
*/
protected function loadConfig()
{
Config::$configDir = $this->configDir;
try {
$this->config = Config::app();
} catch (NotReadableError $e) {
Logger::error(new IcingaException('Cannot load application configuration. An exception was thrown:', $e));
$this->config = new Config();
}
return $this;
}
示例3: tearDown
/**
* Reset config dir
*/
public function tearDown()
{
parent::tearDown();
Config::$configDir = $this->oldConfigDir;
}