I am testing my Zend Framework application and would like to test that something happens when a particular key is not set in the registry. This is the function that I am testing:
protected function getDomainFromConfig() {
$config = Zend_Registry::get('config');
if (!isset($config->domain)) {
throw new Exception('Please make sure you have "domain" set in your config file and your config file is being set in the Zend_Registry.');
}
return $config->domain;
}
How can I unset a key in the registry? I tried this, but it did not work:
$config = Zend_Registry::get('config');
$config->__unset('domain');
Update: What I really want to know is how should I test that my method throws an exception when the "domain" key in the config file is not set.