Skip to content

Commit cd46f4d

Browse files
committed
Fixing function signature of ThemeView constructor. Fixes issues where ThemeView would always be registered causing issues with EmailComponent and themed views. Fixes #370
1 parent fccfe14 commit cd46f4d

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

cake/libs/view/theme.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class ThemeView extends View {
5252
*
5353
* @param unknown_type $controller
5454
*/
55-
function __construct (&$controller) {
56-
parent::__construct($controller);
55+
function __construct (&$controller, $register = true) {
56+
parent::__construct($controller, $register);
5757
$this->theme =& $controller->theme;
5858

5959
if (!empty($this->theme)) {

cake/tests/cases/libs/view/theme.test.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ class ThemeViewTest extends CakeTestCase {
142142
*/
143143
function setUp() {
144144
Router::reload();
145-
$this->Controller = new Controller();
146-
$this->PostsController = new ThemePostsController();
145+
$this->Controller =& new Controller();
146+
$this->PostsController =& new ThemePostsController();
147147
$this->PostsController->viewPath = 'posts';
148148
$this->PostsController->index();
149-
$this->ThemeView = new ThemeView($this->PostsController);
149+
$this->ThemeView =& new ThemeView($this->PostsController);
150150
}
151151
/**
152152
* tearDown method
@@ -158,6 +158,19 @@ function tearDown() {
158158
unset($this->ThemeView);
159159
unset($this->PostsController);
160160
unset($this->Controller);
161+
ClassRegistry::flush();
162+
}
163+
/**
164+
* test that the theme view can be constructed without going into the registry
165+
*
166+
* @return void
167+
*/
168+
function testConstructionNoRegister() {
169+
ClassRegistry::flush();
170+
$controller = null;
171+
$Theme =& new ThemeView($controller, false);
172+
$ThemeTwo =& ClassRegistry::getObject('view');
173+
$this->assertFalse($ThemeTwo);
161174
}
162175
/**
163176
* testPluginGetTemplate method

0 commit comments

Comments
 (0)