Permalink
Browse files

Fixing issue #5764

  • Loading branch information...
Jan Dorsman authored and ADmad committed Jan 28, 2015
1 parent 8f50f1e commit e3b530652117e606d6c3f648d821e07055520c8d
Showing with 23 additions and 0 deletions.
  1. +4 −0 lib/Cake/Network/Email/CakeEmail.php
  2. +19 −0 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
@@ -353,6 +353,10 @@ public function __construct($config = null) {
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 @@ public function assertLineLengths($message) {
}
}
/**
* 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();
}
}
}

0 comments on commit e3b5306

Please sign in to comment.