Skip to content
Permalink
Browse files

email component osFix removal due to new assertTextEquals

  • Loading branch information...
dereuromark authored and markstory committed Feb 6, 2012
1 parent 6412797 commit 2afece41a0c70d350a994b32e5b3252870b91cda
Showing with 15 additions and 25 deletions.
  1. +15 −25 lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
@@ -175,16 +175,6 @@ public function tearDown() {
ClassRegistry::flush();
}
/**
* osFix method
*
* @param string $string
* @return string
*/
function __osFix($string) {
return str_replace(array("\r\n", "\r"), "\n", $string);
}
/**
* testSendFormats method
*
@@ -222,12 +212,12 @@ public function testSendFormats() {
$this->Controller->EmailTest->sendAs = 'text';
$expect = str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $message);
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals(DebugCompTransport::$lastEmail, $this->__osFix($expect));
$this->assertTextEquals(DebugCompTransport::$lastEmail, $expect);
$this->Controller->EmailTest->sendAs = 'html';
$expect = str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $message);
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals(DebugCompTransport::$lastEmail, $this->__osFix($expect));
$this->assertTextEquals(DebugCompTransport::$lastEmail, $expect);
}
/**
@@ -293,12 +283,12 @@ public function testTemplates() {
$this->Controller->EmailTest->sendAs = 'text';
$expect = '<pre>' . str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $header) . $text . "\n" . '</pre>';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals(DebugCompTransport::$lastEmail, $this->__osFix($expect));
$this->assertTextEquals(DebugCompTransport::$lastEmail, $expect);
$this->Controller->EmailTest->sendAs = 'html';
$expect = '<pre>' . str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $header) . $html . "\n" . '</pre>';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals(DebugCompTransport::$lastEmail, $this->__osFix($expect));
$this->assertTextEquals(DebugCompTransport::$lastEmail, $expect);
$this->Controller->EmailTest->sendAs = 'both';
$expect = str_replace('{CONTENTTYPE}', 'multipart/mixed; boundary="{boundary}"', $header);
@@ -320,8 +310,8 @@ public function testTemplates() {
$expect = '<pre>' . $expect . '</pre>';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals(
$this->__osFix($expect),
$this->assertTextEquals(
$expect,
preg_replace('/[a-z0-9]{32}/i', '{boundary}', DebugCompTransport::$lastEmail)
);
@@ -344,7 +334,7 @@ public function testTemplates() {
$this->Controller->EmailTest->sendAs = 'html';
$expect = '<pre>' . str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $header) . $html . '</pre>';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message', 'default', 'thin'));
$this->assertEquals(DebugCompTransport::$lastEmail, $this->__osFix($expect));
$this->assertTextEquals(DebugCompTransport::$lastEmail, $expect);
}
/**
@@ -455,18 +445,18 @@ public function testMessageRetrievalWithoutTemplate() {
$this->Controller->EmailTest->sendAs = 'both';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals($this->Controller->EmailTest->textMessage, $this->__osFix($text));
$this->assertEquals($this->Controller->EmailTest->htmlMessage, $this->__osFix($html));
$this->assertTextEquals($this->Controller->EmailTest->textMessage, $text);
$this->assertTextEquals($this->Controller->EmailTest->htmlMessage, $html);
$this->Controller->EmailTest->sendAs = 'text';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertEquals($this->Controller->EmailTest->textMessage, $this->__osFix($text));
$this->assertTextEquals($this->Controller->EmailTest->textMessage, $text);
$this->assertNull($this->Controller->EmailTest->htmlMessage);
$this->Controller->EmailTest->sendAs = 'html';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertNull($this->Controller->EmailTest->textMessage);
$this->assertEquals($this->Controller->EmailTest->htmlMessage, $this->__osFix($html));
$this->assertTextEquals($this->Controller->EmailTest->htmlMessage, $html);
}
/**
@@ -515,18 +505,18 @@ public function testMessageRetrievalWithTemplate() {
$this->Controller->EmailTest->sendAs = 'both';
$this->assertTrue($this->Controller->EmailTest->send());
$this->assertEquals($this->Controller->EmailTest->textMessage, $this->__osFix($text));
$this->assertEquals($this->Controller->EmailTest->htmlMessage, $this->__osFix($html));
$this->assertTextEquals($this->Controller->EmailTest->textMessage, $text);
$this->assertTextEquals($this->Controller->EmailTest->htmlMessage, $html);
$this->Controller->EmailTest->sendAs = 'text';
$this->assertTrue($this->Controller->EmailTest->send());
$this->assertEquals($this->Controller->EmailTest->textMessage, $this->__osFix($text));
$this->assertTextEquals($this->Controller->EmailTest->textMessage, $text);
$this->assertNull($this->Controller->EmailTest->htmlMessage);
$this->Controller->EmailTest->sendAs = 'html';
$this->assertTrue($this->Controller->EmailTest->send());
$this->assertNull($this->Controller->EmailTest->textMessage);
$this->assertEquals($this->Controller->EmailTest->htmlMessage, $this->__osFix($html));
$this->assertTextEquals($this->Controller->EmailTest->htmlMessage, $html);
}
/**

0 comments on commit 2afece4

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