Skip to content
Permalink
Browse files

create CakeRequest in View instead of in CakeEmail

  • Loading branch information...
rchavik committed Jun 4, 2012
1 parent e821c27 commit 8966f1b324c1967326cc9f57729eefe7883947f6
@@ -1441,12 +1441,6 @@ protected function _renderTemplates($content) {
$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 @@ public function testSendRenderWithImage() {
$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 @@ public function testExportVar() {
validationErrors => array()
hasRendered => false
uuids => array()
request => null
request => object(CakeRequest) {}
response => object(CakeResponse) {}
elementCache => 'default'
int => (int) 2
@@ -314,6 +314,11 @@ public function __construct(Controller $controller = null) {
}
$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 {

0 comments on commit 8966f1b

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