Skip to content

Commit

Permalink
unify to expected
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Jan 9, 2014
1 parent 29e1538 commit 97e43e5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ public function testSendFormats() {
MSGBLOC; MSGBLOC;


$this->Controller->EmailTest->sendAs = 'text'; $this->Controller->EmailTest->sendAs = 'text';
$expects = str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $message); $expected = str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $message);
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertTextEquals($expects, DebugCompTransport::$lastEmail); $this->assertTextEquals($expected, DebugCompTransport::$lastEmail);


$this->Controller->EmailTest->sendAs = 'html'; $this->Controller->EmailTest->sendAs = 'html';
$expects = str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $message); $expected = str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $message);
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertTextEquals($expects, DebugCompTransport::$lastEmail); $this->assertTextEquals($expected, DebugCompTransport::$lastEmail);
} }


/** /**
Expand Down Expand Up @@ -262,18 +262,18 @@ public function testTemplates() {
HTMLBLOC; HTMLBLOC;


$this->Controller->EmailTest->sendAs = 'text'; $this->Controller->EmailTest->sendAs = 'text';
$expects = '<pre>' . str_replace('{CONTENTTYPE}', 'text/plain; charset=UTF-8', $header) . $text . "\n" . '</pre>'; $expected = '<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->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertTextEquals($expects, DebugCompTransport::$lastEmail); $this->assertTextEquals($expected, DebugCompTransport::$lastEmail);


$this->Controller->EmailTest->sendAs = 'html'; $this->Controller->EmailTest->sendAs = 'html';
$expects = '<pre>' . str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $header) . $html . "\n" . '</pre>'; $expected = '<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->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertTextEquals($expects, DebugCompTransport::$lastEmail); $this->assertTextEquals($expected, DebugCompTransport::$lastEmail);


$this->Controller->EmailTest->sendAs = 'both'; $this->Controller->EmailTest->sendAs = 'both';
$expects = str_replace('{CONTENTTYPE}', 'multipart/mixed; boundary="{boundary}"', $header); $expected = str_replace('{CONTENTTYPE}', 'multipart/mixed; boundary="{boundary}"', $header);
$expects .= "--{boundary}\n" . $expected .= "--{boundary}\n" .
'Content-Type: multipart/alternative; boundary="alt-{boundary}"' . "\n\n" . 'Content-Type: multipart/alternative; boundary="alt-{boundary}"' . "\n\n" .
'--alt-{boundary}' . "\n" . '--alt-{boundary}' . "\n" .
'Content-Type: text/plain; charset=UTF-8' . "\n" . 'Content-Type: text/plain; charset=UTF-8' . "\n" .
Expand All @@ -288,11 +288,11 @@ public function testTemplates() {
'--alt-{boundary}--' . "\n\n\n" . '--alt-{boundary}--' . "\n\n\n" .
'--{boundary}--' . "\n"; '--{boundary}--' . "\n";


$expects = '<pre>' . $expects . '</pre>'; $expected = '<pre>' . $expected . '</pre>';


$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message')); $this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$this->assertTextEquals( $this->assertTextEquals(
$expects, $expected,
preg_replace('/[a-z0-9]{32}/i', '{boundary}', DebugCompTransport::$lastEmail) preg_replace('/[a-z0-9]{32}/i', '{boundary}', DebugCompTransport::$lastEmail)
); );


Expand All @@ -313,9 +313,9 @@ public function testTemplates() {
HTMLBLOC; HTMLBLOC;


$this->Controller->EmailTest->sendAs = 'html'; $this->Controller->EmailTest->sendAs = 'html';
$expects = '<pre>' . str_replace('{CONTENTTYPE}', 'text/html; charset=UTF-8', $header) . $html . '</pre>'; $expected = '<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->assertTrue($this->Controller->EmailTest->send('This is the body of the message', 'default', 'thin'));
$this->assertTextEquals($expects, DebugCompTransport::$lastEmail); $this->assertTextEquals($expected, DebugCompTransport::$lastEmail);
} }


/** /**
Expand Down

0 comments on commit 97e43e5

Please sign in to comment.