mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
create CakeRequest in View instead of in CakeEmail
This commit is contained in:
parent
e821c27f54
commit
8966f1b324
4 changed files with 7 additions and 19 deletions
|
@ -1441,12 +1441,6 @@ class CakeEmail {
|
|||
$View = new $viewClass(null);
|
||||
$View->viewVars = $this->_viewVars;
|
||||
$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($layoutPlugin, $layout) = pluginSplit($this->_layout);
|
||||
|
|
|
@ -1044,18 +1044,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$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,
|
||||
));
|
||||
|
||||
$expected = '<img src="http://localhost/img/image.gif" alt="cool image" width="100" height="100" />';
|
||||
$result = $this->CakeEmail->send();
|
||||
$this->assertContains($expected, $result['message']);
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ object(View) {
|
|||
validationErrors => array()
|
||||
hasRendered => false
|
||||
uuids => array()
|
||||
request => null
|
||||
request => object(CakeRequest) {}
|
||||
response => object(CakeResponse) {}
|
||||
elementCache => 'default'
|
||||
int => (int) 2
|
||||
|
|
|
@ -314,6 +314,11 @@ class View extends Object {
|
|||
}
|
||||
$this->_eventManager = $controller->getEventManager();
|
||||
}
|
||||
if (empty($this->request) && !($this->request = Router::getRequest(true))) {
|
||||
$this->request = new CakeRequest(null, false);
|
||||
$this->request->base = '';
|
||||
$this->request->here = $this->request->webroot = '/';
|
||||
}
|
||||
if (is_object($controller) && isset($controller->response)) {
|
||||
$this->response = $controller->response;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue