mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding failing test for #917
This commit is contained in:
parent
21f359bff9
commit
0e184c66f4
1 changed files with 32 additions and 1 deletions
|
@ -391,6 +391,16 @@ class TestComponent extends Object {
|
|||
*/
|
||||
function shutdown(&$controller) {
|
||||
}
|
||||
/**
|
||||
* beforeRender callback
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function beforeRender(&$controller) {
|
||||
if ($this->viewclass) {
|
||||
$controller->view = $this->viewclass;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -894,6 +904,27 @@ class ControllerTest extends CakeTestCase {
|
|||
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 @@ class ControllerTest extends CakeTestCase {
|
|||
$MockedController->MockTest->expectCallCount('shutdown', 1);
|
||||
$MockedController->shutdownProcess();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue