Fixed the tests.

This commit is contained in:
Juan Basso 2011-04-13 00:20:35 -04:00
parent 3200e380d3
commit 9ac5f9c349
3 changed files with 7 additions and 2 deletions

View file

@ -567,6 +567,7 @@ class CakeEmail {
}
if ($this->_messageId !== false) {
if ($this->_messageId === true) {
App::uses('String', 'Utility');
$headers['Message-ID'] = '<' . String::UUID() . '@' . env('HTTP_HOST') . '>';
} else {
$headers['Message-ID'] = $this->_messageId;
@ -808,7 +809,7 @@ class CakeEmail {
public function send($content = null) {
if (is_string($this->_config)) {
if (!config('email')) {
throw new SocketException(__d('cake', '%s not found.', APP . DS . 'email.php'));
throw new SocketException(__d('cake', '%s not found.', APP . 'config' . DS . 'email.php'));
}
$configs = new EMAIL_CONFIG();
if (!isset($configs->{$this->_config})) {
@ -1077,6 +1078,7 @@ class CakeEmail {
protected function _render($content) {
$viewClass = $this->_viewRender;
App::uses('View', 'View');
if ($viewClass !== 'View') {
list($plugin, $viewClass) = pluginSplit($viewClass, true);
$viewClass .= 'View';

View file

@ -110,7 +110,7 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail = new TestCakeEmail();
App::build(array(
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
'views' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'View'. DS)
));
}
@ -421,6 +421,7 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail->from('cake@cakephp.org');
$this->CakeEmail->to(array('you@cakephp.org' => 'You'));
$this->CakeEmail->subject('My title');
$this->CakeEmail->config(array('empty'));
$result = $this->CakeEmail->send("Here is my body, with multi lines.\nThis is the second line.\r\n\r\nAnd the last.");
$this->assertTrue($result);
@ -450,6 +451,7 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail->from('cake@cakephp.org');
$this->CakeEmail->to(array('you@cakephp.org' => 'You'));
$this->CakeEmail->subject('My title');
$this->CakeEmail->config(array('empty'));
$this->CakeEmail->layout('default', 'default');
$result = $this->CakeEmail->send();

View file

@ -17,6 +17,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeEmail', 'Network');
App::uses('AbstractTransport', 'Network/Email');
App::uses('SmtpTransport', 'Network/Email');
/**