Fixing issues in Scaffold Test case with PHP4.

Cleaning up code formatting in Scaffold.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8276 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2009-08-03 17:38:40 +00:00
parent 07d1ecdf6d
commit 29dd4ddf03
2 changed files with 11 additions and 13 deletions

View file

@ -167,7 +167,7 @@ class Scaffold extends Object {
$associations = $this->__associations(); $associations = $this->__associations();
$this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', $this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations')); 'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
if ($this->controller->view && $this->controller->view !== 'Theme') { if ($this->controller->view && $this->controller->view !== 'Theme') {
$this->controller->view = 'scaffold'; $this->controller->view = 'scaffold';
@ -378,7 +378,7 @@ class Scaffold extends Object {
* @access private * @access private
*/ */
function __scaffold($params) { function __scaffold($params) {
$db = &ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig); $db =& ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);
$admin = Configure::read('Routing.admin'); $admin = Configure::read('Routing.admin');
if (isset($db)) { if (isset($db)) {

View file

@ -228,21 +228,21 @@ class ScaffoldViewTest extends CakeTestCase {
*/ */
var $fixtures = array('core.article', 'core.user', 'core.comment'); var $fixtures = array('core.article', 'core.user', 'core.comment');
/** /**
* setUp method * startTest method
* *
* @access public * @access public
* @return void * @return void
*/ */
function setUp() { function startTest() {
$this->Controller =& new ScaffoldMockController(); $this->Controller =& new ScaffoldMockController();
} }
/** /**
* tearDown method * endTest method
* *
* @access public * @access public
* @return void * @return void
*/ */
function tearDown() { function endTest() {
unset($this->Controller); unset($this->Controller);
} }
/** /**
@ -452,7 +452,6 @@ class ScaffoldViewTest extends CakeTestCase {
$this->assertPattern('/textarea name="data\[ScaffoldMock\]\[body\]" cols="30" rows="6" id="ScaffoldMockBody"/', $result); $this->assertPattern('/textarea name="data\[ScaffoldMock\]\[body\]" cols="30" rows="6" id="ScaffoldMockBody"/', $result);
$this->assertPattern('/<li><a href="\/scaffold_mock\/delete\/1"[^>]*>Delete<\/a>\s*<\/li>/', $result); $this->assertPattern('/<li><a href="\/scaffold_mock\/delete\/1"[^>]*>Delete<\/a>\s*<\/li>/', $result);
} }
/** /**
* Test Admin Index Scaffolding. * Test Admin Index Scaffolding.
* *
@ -562,21 +561,21 @@ class ScaffoldTest extends CakeTestCase {
*/ */
var $fixtures = array('core.article', 'core.user', 'core.comment'); var $fixtures = array('core.article', 'core.user', 'core.comment');
/** /**
* setUp method * startTest method
* *
* @access public * @access public
* @return void * @return void
*/ */
function setUp() { function startTest() {
$this->Controller =& new ScaffoldMockController(); $this->Controller =& new ScaffoldMockController();
} }
/** /**
* tearDown method * endTest method
* *
* @access public * @access public
* @return void * @return void
*/ */
function tearDown() { function endTest() {
unset($this->Controller); unset($this->Controller);
} }
/** /**
@ -611,7 +610,6 @@ class ScaffoldTest extends CakeTestCase {
$result = $Scaffold->getParams(); $result = $Scaffold->getParams();
$this->assertEqual($result['action'], 'admin_edit'); $this->assertEqual($result['action'], 'admin_edit');
} }
/** /**
* test that the proper names and variable values are set by Scaffold * test that the proper names and variable values are set by Scaffold
* *
@ -639,7 +637,7 @@ class ScaffoldTest extends CakeTestCase {
$this->Controller->base = '/'; $this->Controller->base = '/';
$this->Controller->constructClasses(); $this->Controller->constructClasses();
$Scaffold =& new TestScaffoldMock($this->Controller, $params); $Scaffold =& new TestScaffoldMock($this->Controller, $params);
$result = $this->Controller->viewVars; $result = $Scaffold->controller->viewVars;
$this->assertEqual($result['singularHumanName'], 'Scaffold Mock'); $this->assertEqual($result['singularHumanName'], 'Scaffold Mock');
$this->assertEqual($result['pluralHumanName'], 'Scaffold Mock'); $this->assertEqual($result['pluralHumanName'], 'Scaffold Mock');