Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing function signature of ThemeView constructor. Fixes issues wher…
…e ThemeView would always be registered causing issues with EmailComponent and themed views. Fixes #370
  • Loading branch information
markstory committed Nov 30, 2009
1 parent fccfe14 commit cd46f4d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cake/libs/view/theme.php
Expand Up @@ -52,8 +52,8 @@ class ThemeView extends View {
*
* @param unknown_type $controller
*/
function __construct (&$controller) {
parent::__construct($controller);
function __construct (&$controller, $register = true) {
parent::__construct($controller, $register);
$this->theme =& $controller->theme;

if (!empty($this->theme)) {
Expand Down
19 changes: 16 additions & 3 deletions cake/tests/cases/libs/view/theme.test.php
Expand Up @@ -142,11 +142,11 @@ class ThemeViewTest extends CakeTestCase {
*/
function setUp() {
Router::reload();
$this->Controller = new Controller();
$this->PostsController = new ThemePostsController();
$this->Controller =& new Controller();
$this->PostsController =& new ThemePostsController();
$this->PostsController->viewPath = 'posts';
$this->PostsController->index();
$this->ThemeView = new ThemeView($this->PostsController);
$this->ThemeView =& new ThemeView($this->PostsController);
}
/**
* tearDown method
Expand All @@ -158,6 +158,19 @@ function tearDown() {
unset($this->ThemeView);
unset($this->PostsController);
unset($this->Controller);
ClassRegistry::flush();
}
/**
* test that the theme view can be constructed without going into the registry
*
* @return void
*/
function testConstructionNoRegister() {
ClassRegistry::flush();
$controller = null;
$Theme =& new ThemeView($controller, false);
$ThemeTwo =& ClassRegistry::getObject('view');
$this->assertFalse($ThemeTwo);
}
/**
* testPluginGetTemplate method
Expand Down

0 comments on commit cd46f4d

Please sign in to comment.