Skip to content
Permalink
Browse files

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

…ring.
  • Loading branch information...
jperras committed Aug 10, 2009
1 parent c3aa0de commit 6f0f5596cbcaf5b865713719d6c55b9f927ca970
Showing with 30 additions and 0 deletions.
  1. +30 −0 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
*

0 comments on commit 6f0f559

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