mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 19:16:16 +00:00
Adding a test for loading of custom view class for email layout rendering.
This commit is contained in:
parent
c3aa0de244
commit
6f0f5596cb
1 changed files with 30 additions and 0 deletions
|
@ -745,6 +745,36 @@ TEXTBLOC;
|
||||||
$this->assertIdentical($this->Controller->EmailTest->attachments, array());
|
$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
|
* testStartup method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue