mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Removing old check for view == 'Theme'. This allows Scaffold to work well with Themed controllers. Test case added. Fixes #255
This commit is contained in:
parent
7e7a2c57e2
commit
3099a15f17
2 changed files with 21 additions and 2 deletions
|
@ -193,8 +193,8 @@ class Scaffold extends Object {
|
|||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'
|
||||
));
|
||||
|
||||
if ($this->controller->view && $this->controller->view !== 'Theme') {
|
||||
$this->controller->view = 'scaffold';
|
||||
if ($this->controller->view) {
|
||||
$this->controller->view = 'Scaffold';
|
||||
}
|
||||
$this->_validSession = (
|
||||
isset($this->controller->Session) && $this->controller->Session->valid() != false
|
||||
|
|
|
@ -730,6 +730,7 @@ class ScaffoldTest extends CakeTestCase {
|
|||
$result = $Scaffold->getParams();
|
||||
$this->assertEqual($result['action'], 'admin_edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that the proper names and variable values are set by Scaffold
|
||||
*
|
||||
|
@ -769,6 +770,24 @@ class ScaffoldTest extends CakeTestCase {
|
|||
$this->assertEqual($result['pluralVar'], 'scaffoldMock');
|
||||
$this->assertEqual($result['scaffoldFields'], array('id', 'user_id', 'title', 'body', 'published', 'created', 'updated'));
|
||||
}
|
||||
function getTests() {
|
||||
return array('start', 'startCase', 'testScaffoldChangingViewProperty', 'endCase', 'end');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that Scaffold overrides the view property even if its set to 'Theme'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testScaffoldChangingViewProperty() {
|
||||
$this->Controller->action = 'edit';
|
||||
$this->Controller->theme = 'test_theme';
|
||||
$this->Controller->view = 'Theme';
|
||||
$this->Controller->constructClasses();
|
||||
$Scaffold =& new TestScaffoldMock($this->Controller, array());
|
||||
|
||||
$this->assertEqual($this->Controller->view, 'Scaffold');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that scaffold outputs flash messages when sessions are unset.
|
||||
|
|
Loading…
Add table
Reference in a new issue