本文整理匯總了PHP中rex::hasConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP rex::hasConfig方法的具體用法?PHP rex::hasConfig怎麽用?PHP rex::hasConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rex
的用法示例。
在下文中一共展示了rex::hasConfig方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRexConfig
public function testRexConfig()
{
$key = 'aTestKey';
// initial test on empty config
$this->assertFalse(rex::hasConfig($key), 'the key does not exists at first');
$this->assertNull(rex::getConfig($key), 'getting non existing key returns null');
$this->assertEquals(rex::getConfig($key, 'defVal'), 'defVal', 'getting non existing key returns a given default');
$this->assertFalse(rex::removeConfig($key), 'remove non existing key returns false');
// test after setting a value
$this->assertFalse(rex::setConfig($key, 'aVal'), 'setting non-existant value returns false');
$this->assertEquals(rex::getConfig($key, 'defVal'), 'aVal', 'getting existing key returns its value');
$this->assertTrue(rex::hasConfig($key), 'setted value exists');
// test after re-setting a value
$this->assertTrue(rex::setConfig($key, 'aOtherVal'), 're-setting a value returns true');
$this->assertEquals(rex::getConfig($key, 'defaOtherVal'), 'aOtherVal', 'getting existing key returns its value');
// test after cleanup
$this->assertTrue(rex::removeConfig($key), 'remove a existing key returns true');
$this->assertFalse(rex::hasConfig($key), 'the key does not exists after removal');
$this->assertNull(rex::getConfig($key), 'getting non existing key returns null');
$this->assertEquals(rex::getConfig($key, 'defVal'), 'defVal', 'getting non existing key returns a given default');
}