/** * @param string $key * @return mixed * @throws Exception */ public static function getConfigField($key) { if (empty(static::$configArray)) { Config::init(); } $configField = static::$configArray[$key]; if ($configField === null) { throw new Exception(ErrorMessages::getConfigFieldNotFoundMessage($key)); } return $configField; }
public function testGetNonExistentConfigValue() { $this->setExpectedException("Exception", ErrorMessages::getConfigFieldNotFoundMessage("NonExistent")); Config::setConfigField("NonExistent", null); Config::getConfigField("NonExistent"); }