diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index 679a75b..f209741 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -1,6 +1,9 @@ configIO = $configIO; } } - -/** - * Exception used if a mandatory field is missing in given configuration. - */ -class MissingFieldConfigException extends \Exception -{ - public $field; - - /** - * Construct exception. - * - * @param string $field field name missing. - */ - public function __construct($field) - { - $this->field = $field; - $this->message = 'Configuration value is required for '. $this->field; - } -} - -/** - * Exception used if an unauthorized attempt to edit configuration has been made. - */ -class UnauthorizedConfigException extends \Exception -{ - /** - * Construct exception. - */ - public function __construct() - { - $this->message = 'You are not authorized to alter config.'; - } -} diff --git a/application/config/exception/MissingFieldConfigException.php b/application/config/exception/MissingFieldConfigException.php new file mode 100644 index 0000000..6346c6a --- /dev/null +++ b/application/config/exception/MissingFieldConfigException.php @@ -0,0 +1,23 @@ +field = $field; + $this->message = 'Configuration value is required for '. $this->field; + } +} diff --git a/application/config/exception/UnauthorizedConfigException.php b/application/config/exception/UnauthorizedConfigException.php new file mode 100644 index 0000000..79672c1 --- /dev/null +++ b/application/config/exception/UnauthorizedConfigException.php @@ -0,0 +1,18 @@ +message = 'You are not authorized to alter config.'; + } +} diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index b81be5b..1ec447b 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php @@ -106,7 +106,7 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase /** * Try to write the config without mandatory parameter (e.g. 'login'). * - * @expectedException Shaarli\Config\MissingFieldConfigException + * @expectedException Shaarli\Config\Exception\MissingFieldConfigException */ public function testWriteMissingParameter() {