mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Throwing exception instead notice in loadConfig.
This commit is contained in:
parent
175e008308
commit
5b8f680d43
2 changed files with 20 additions and 24 deletions
|
@ -937,15 +937,14 @@ class HtmlHelper extends AppHelper {
|
|||
$reader = $configFile[1];
|
||||
}
|
||||
} else {
|
||||
return trigger_error(__('Cannot load the configuration file. Wrong "configFile" configuration.'), E_USER_NOTICE);
|
||||
throw new ConfigureException(__('Cannot load the configuration file. Wrong "configFile" configuration.'));
|
||||
}
|
||||
|
||||
$readerClass = Inflector::camelize($reader) . 'Reader';
|
||||
if (!App::import('Lib', 'config/' . $readerClass)) {
|
||||
return trigger_error(__('Cannot load the configuration file. Unknown reader.'), E_USER_NOTICE);
|
||||
throw new ConfigureException(__('Cannot load the configuration file. Unknown reader.'));
|
||||
}
|
||||
|
||||
try {
|
||||
$readerObj = new $readerClass($path);
|
||||
$configs = $readerObj->read($file);
|
||||
if (isset($configs['tags']) && is_array($configs['tags'])) {
|
||||
|
@ -963,9 +962,6 @@ class HtmlHelper extends AppHelper {
|
|||
if (isset($configs['minimizedAttributeFormat'])) {
|
||||
$this->_minimizedAttributeFormat = $configs['minimizedAttributeFormat'];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return trigger_error(__('Cannot load the configuration file. Failed to load the file.'), E_USER_NOTICE);
|
||||
}
|
||||
return $configs;
|
||||
}
|
||||
|
||||
|
|
|
@ -1400,11 +1400,11 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
$this->assertEqual($this->Html->getAttribute('_minimizedAttributeFormat'), 'format');
|
||||
|
||||
$this->expectError();
|
||||
$this->expectException('ConfigureException');
|
||||
$result = $this->Html->loadConfig('wrong_file');
|
||||
$this->assertFalse($result);
|
||||
|
||||
$this->expectError();
|
||||
$this->expectException('ConfigureException');
|
||||
$result = $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue