Skip to content
Permalink
Browse files

Fix fatal error on null subject.

Refs #7176
  • Loading branch information...
markstory committed Aug 6, 2015
1 parent 01b6374 commit 9f20330d179cf759692537edb3e75fdd3adcbf7b
@@ -309,7 +309,8 @@ public function send($content = null, $template = null, $layout = null) {
$lib->readReceipt($this->_formatAddresses((array)$this->readReceipt));
}
$lib->subject($this->subject)->messageID($this->messageId);
$lib->subject($this->subject);
$lib->messageID($this->messageId);
$lib->helpers($this->_controller->helpers);
$headers = array('X-Mailer' => $this->xMailer);
@@ -339,6 +339,32 @@ public function testTemplateNestedElements() {
$this->assertRegExp('/http\:\/\/example\.com/', $result);
}
/**
* test send with null properties
*
* @return void
*/
public function testSendNullProperties() {
$this->Controller->EmailTest->to = 'test@example.com';
$this->Controller->EmailTest->from = 'test@example.com';
$this->Controller->EmailTest->subject = null;
$this->Controller->EmailTest->replyTo = null;
$this->Controller->EmailTest->messageId = null;
$this->Controller->EmailTest->template = null;
$this->Controller->EmailTest->delivery = 'DebugComp';
$this->assertTrue($this->Controller->EmailTest->send(null));
$result = DebugCompTransport::$lastEmail;
$this->assertRegExp('/To: test@example.com\n/', $result);
$this->assertRegExp('/Subject: \n/', $result);
$this->assertRegExp('/From: test@example.com\n/', $result);
$this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
}
/**
* testSendDebug method
*

0 comments on commit 9f20330

Please sign in to comment.
You can’t perform that action at this time.