diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index f0da7182f..959017556 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -325,6 +325,13 @@ class CakeEmail { */ protected $_emailPattern = null; +/** + * The classname used for email configuration. + * + * @var string + */ + protected $_configClass = 'EmailConfig'; + /** * Constructor * @@ -1179,10 +1186,10 @@ class CakeEmail { */ protected function _applyConfig($config) { if (is_string($config)) { - if (!class_exists('EmailConfig') && !config('email')) { + if (!class_exists($this->_configClass) && !config('email')) { throw new ConfigureException(__d('cake_dev', '%s not found.', APP . 'Config' . DS . 'email.php')); } - $configs = new EmailConfig(); + $configs = new $this->_configClass(); if (!isset($configs->{$config})) { throw new ConfigureException(__d('cake_dev', 'Unknown email configuration "%s".', $config)); } diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index 025d96530..9fbb8c207 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -26,6 +26,15 @@ App::uses('CakeEmail', 'Network/Email'); */ class TestCakeEmail extends CakeEmail { +/** + * Config classname. + * + * Use a the testing config class in this file. + * + * @var string + */ + protected $_configClass = 'TestEmailConfig'; + /** * Config * @@ -79,7 +88,7 @@ class TestCakeEmail extends CakeEmail { * EmailConfig class * */ -class EmailConfig { +class TestEmailConfig { /** * test config @@ -841,7 +850,7 @@ class CakeEmailTest extends CakeTestCase { * @return void */ public function testConfigString() { - $configs = new EmailConfig(); + $configs = new TestEmailConfig(); $this->CakeEmail->config('test'); $result = $this->CakeEmail->to(); @@ -1767,8 +1776,8 @@ class CakeEmailTest extends CakeTestCase { * @return void */ public function testConstructWithConfigString() { - $configs = new EmailConfig(); - $this->CakeEmail = new CakeEmail('test'); + $configs = new TestEmailConfig(); + $this->CakeEmail = new TestCakeEmail('test'); $result = $this->CakeEmail->to(); $this->assertEquals($configs->test['to'], $result);