mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing issue #5764
This commit is contained in:
parent
8f50f1eab2
commit
e3b5306521
2 changed files with 23 additions and 0 deletions
|
@ -353,6 +353,10 @@ class CakeEmail {
|
|||
|
||||
if ($config) {
|
||||
$this->config($config);
|
||||
} elseif (config('email')) {
|
||||
if (property_exists($this->_configClass, 'default')) {
|
||||
$this->config('default');
|
||||
}
|
||||
}
|
||||
if (empty($this->headerCharset)) {
|
||||
$this->headerCharset = $this->charset;
|
||||
|
|
|
@ -2449,4 +2449,23 @@ HTML;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the EmailConfig::$default configuration is read when present
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDefaultConfig() {
|
||||
$defaultConfig = new File(APP . 'Config' . DS . 'email.php.default');
|
||||
$emailConfig = new File(APP . 'Config' . DS . 'email.php');
|
||||
$hasConfig = $emailConfig->exists();
|
||||
$this->skipIf(!$defaultConfig->copy(APP . 'Config' . DS . 'email.php', false));
|
||||
|
||||
$Email = new CakeEmail();
|
||||
$this->skipIf(!property_exists('EmailConfig', 'default'));
|
||||
$this->assertEquals('you@localhost', current($Email->from()));
|
||||
if (!$hasConfig) {
|
||||
$emailConfig->delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue