Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding a test for loading of custom view class for email layout rende…

…ring.
  • Loading branch information...
commit 6f0f5596cbcaf5b865713719d6c55b9f927ca970 1 parent c3aa0de
@jperras jperras authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 cake/tests/cases/libs/controller/components/email.test.php
View
30 cake/tests/cases/libs/controller/components/email.test.php
@@ -745,6 +745,36 @@ function testReset() {
$this->assertIdentical($this->Controller->EmailTest->attachments, array());
}
+ function testCustomViewClass() {
+ App::build(array(
+ 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
+ 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
+ ));
+
+ $this->Controller->EmailTest->reset();
+
+ $this->Controller->view = 'TestPlugin.Email';
+
+ $this->Controller->EmailTest->to = 'postmaster@localhost';
+ $this->Controller->EmailTest->from = 'noreply@example.com';
+ $this->Controller->EmailTest->subject = 'CustomViewClass test';
+ $this->Controller->EmailTest->replyTo = 'noreply@example.com';
+
+ $this->Controller->EmailTest->template = 'default';
+ $this->Controller->EmailTest->layout = 'default';
+
+ $this->Controller->EmailTest->delivery = 'debug';
+ $body = 'Body of message';
+
+ $this->Controller->EmailTest->sendAs = 'text';
+ $this->assertTrue($this->Controller->EmailTest->send($body));
+ $result = $this->Controller->Session->read('Message.email.message');
+
+ $this->assertPattern('/Body of message/', $result);
+
+ debug($result, true);
+ }
+
/**
* testStartup method
*
Please sign in to comment.
Something went wrong with that request. Please try again.