mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
parent
d1819dcabb
commit
9bafc5a3bb
4 changed files with 64 additions and 0 deletions
|
@ -1441,6 +1441,12 @@ class CakeEmail {
|
||||||
$View = new $viewClass(null);
|
$View = new $viewClass(null);
|
||||||
$View->viewVars = $this->_viewVars;
|
$View->viewVars = $this->_viewVars;
|
||||||
$View->helpers = $this->_helpers;
|
$View->helpers = $this->_helpers;
|
||||||
|
if (!$request = Router::getRequest(true)) {
|
||||||
|
$request = new CakeRequest('/', false);
|
||||||
|
$request->base = '';
|
||||||
|
$request->here = $request->webroot = '/';
|
||||||
|
}
|
||||||
|
$View->request = $request;
|
||||||
|
|
||||||
list($templatePlugin, $template) = pluginSplit($this->_template);
|
list($templatePlugin, $template) = pluginSplit($this->_template);
|
||||||
list($layoutPlugin, $layout) = pluginSplit($this->_layout);
|
list($layoutPlugin, $layout) = pluginSplit($this->_layout);
|
||||||
|
|
|
@ -1028,6 +1028,38 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->assertEquals(array('Time'), $result);
|
$this->assertEquals(array('Time'), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSendRenderWithImage method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testSendRenderWithImage() {
|
||||||
|
$this->CakeEmail->reset();
|
||||||
|
$this->CakeEmail->transport('Debug');
|
||||||
|
|
||||||
|
$this->CakeEmail->from('cake@cakephp.org');
|
||||||
|
$this->CakeEmail->to(array('you@cakephp.org' => 'You'));
|
||||||
|
$this->CakeEmail->subject('My title');
|
||||||
|
$this->CakeEmail->config(array('empty'));
|
||||||
|
$this->CakeEmail->template('image');
|
||||||
|
$this->CakeEmail->emailFormat('html');
|
||||||
|
|
||||||
|
$View = new View();
|
||||||
|
$View->request = new CakeRequest('/', true);
|
||||||
|
$View->request->base = '';
|
||||||
|
$View->request->webroot = '/';
|
||||||
|
$View->request->here = '/';
|
||||||
|
$View->Helpers->load('Html');
|
||||||
|
|
||||||
|
$expected = $View->Html->image('image.gif', array(
|
||||||
|
'fullBase' => true, 'alt' => 'cool image',
|
||||||
|
'width' => 100, 'height' => 100,
|
||||||
|
));
|
||||||
|
|
||||||
|
$result = $this->CakeEmail->send();
|
||||||
|
$this->assertContains($expected, $result['message']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSendRenderPlugin method
|
* testSendRenderPlugin method
|
||||||
*
|
*
|
||||||
|
|
23
lib/Cake/Test/test_app/View/Emails/html/image.ctp
Normal file
23
lib/Cake/Test/test_app/View/Emails/html/image.ctp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* PHP 5
|
||||||
|
*
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
|
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
|
* @since CakePHP(tm) v 2.1
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo $this->Html->image('image.gif', array(
|
||||||
|
'alt' => 'cool image',
|
||||||
|
'width' => 100,
|
||||||
|
'height' => 100,
|
||||||
|
'fullBase' => true,
|
||||||
|
));
|
|
@ -313,6 +313,9 @@ class Helper extends Object {
|
||||||
$path = h($this->assetTimestamp($this->webroot($path)));
|
$path = h($this->assetTimestamp($this->webroot($path)));
|
||||||
|
|
||||||
if (!empty($options['fullBase'])) {
|
if (!empty($options['fullBase'])) {
|
||||||
|
if ($path[0] == '/') {
|
||||||
|
$path = substr($path, 1);
|
||||||
|
}
|
||||||
$path = $this->url('/', true) . $path;
|
$path = $this->url('/', true) . $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue