Skip to content

Commit

Permalink
Add TestCase for Network/Email/CakeEmail.php
Browse files Browse the repository at this point in the history
  • Loading branch information
TAKAHASHI Kunihiko committed May 17, 2013
1 parent a562d9c commit f541260
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ public function testHeaderEncoding() {
}

public function testWrapLongLine() {
$message = '<a href="http://cakephp.org">' . str_repeat('1234567890', 100) . "</a>";
$message = '<a href="http://cakephp.org">' . str_repeat('x', CakeEmail::LINE_LENGTH_MUST) . "</a>";

$this->CakeEmail->reset();
$this->CakeEmail->transport('Debug');
Expand All @@ -1632,7 +1632,27 @@ public function testWrapLongLine() {
$this->CakeEmail->subject('Wordwrap Test');
$this->CakeEmail->config(array('empty'));
$result = $this->CakeEmail->send($message);
$expected = "<a\r\n" . 'href="http://cakephp.org">' . str_repeat('1234567890', 100) . "\r\n</a>\r\n\r\n";
$expected = "<a\r\n" . 'href="http://cakephp.org">' . str_repeat('x', CakeEmail::LINE_LENGTH_MUST) . "\r\n</a>\r\n\r\n";
$this->assertEquals($expected, $result['message']);
}

public function testWrapIncludeTag() {
$message = '<a href="http://cakephp.org">CakePHP</a>';

$this->CakeEmail->reset();
$this->CakeEmail->transport('Debug');
$this->CakeEmail->from('cake@cakephp.org');
$this->CakeEmail->to('cake@cakephp.org');
$this->CakeEmail->subject('Wordwrap Test');
$this->CakeEmail->config(array('empty'));
$result = $this->CakeEmail->send($message);
$expected = "{$message}\r\n\r\n";
$this->assertEquals($expected, $result['message']);

$message = 'foo<bar';

$result = $this->CakeEmail->send($message);
$expected = "{$message}\r\n\r\n";
$this->assertEquals($expected, $result['message']);
}

Expand Down

0 comments on commit f541260

Please sign in to comment.