本文整理汇总了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');
}