Skip to content
Permalink
Browse files

Adding failing test for #917

  • Loading branch information...
markstory committed Jul 16, 2010
1 parent 21f359b commit 0e184c66f4cf871fc7a7722f1e84aed50371f66a
Showing with 32 additions and 1 deletion.
  1. +32 −1 cake/tests/cases/libs/controller/controller.test.php
@@ -391,6 +391,16 @@ function startup(&$controller) {
*/
function shutdown(&$controller) {
}
/**
* beforeRender callback
*
* @return void
*/
function beforeRender(&$controller) {
if ($this->viewclass) {
$controller->view = $this->viewclass;
}
}
}
/**
@@ -894,6 +904,27 @@ function testRender() {
App::build();
}
/**
* test that a component beforeRender can change the controller view class.
*
* @return void
*/
function testComponentBeforeRenderChangingViewClass() {
App::build(array(
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
), true);
$Controller =& new Controller();
$Controller->uses = array();
$Controller->components = array('Test');
$Controller->constructClasses();
$Controller->Test->viewclass = 'Theme';
$Controller->viewPath = 'posts';
$Controller->theme = 'test_theme';
$result = $Controller->render('index');
$this->assertPattern('/posts index themed view/', $result);
App::build();
}
/**
* testToBeInheritedGuardmethods method
*
@@ -1411,4 +1442,4 @@ function testShutdownProcess() {
$MockedController->MockTest->expectCallCount('shutdown', 1);
$MockedController->shutdownProcess();
}
}
}

0 comments on commit 0e184c6

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