Skip to content

Commit

Permalink
Fixing ScaffoldView test
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Feb 23, 2011
1 parent 90cdf51 commit 4e1fcbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/View/ScaffoldView.php
Expand Up @@ -80,7 +80,7 @@ protected function _getViewFileName($name = null) {
}

if ($name === 'scaffolds' . DS . $subDir . 'error') {
return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
return LIBS . 'View' . DS . 'errors' . DS . 'scaffold_error.ctp';
}

throw new MissingViewException($paths[0] . $name . $this->ext);
Expand Down
24 changes: 13 additions & 11 deletions lib/Cake/tests/cases/libs/controller/scaffold.test.php
Expand Up @@ -16,8 +16,10 @@
* @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Scaffold', 'Controller');

App::uses('Controller', 'Controller');
App::uses('Scaffold', 'Controller');
App::uses('ScaffoldView', 'View');

/**
* ScaffoldMockController class
Expand Down Expand Up @@ -277,7 +279,7 @@ function setUp() {
$this->Controller->response = $this->getMock('CakeResponse', array('_sendHeader'));

App::build(array(
'views' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'views' . DS),
'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'views' . DS),
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
}
Expand Down Expand Up @@ -305,39 +307,39 @@ function testGetViewFilename() {
$this->Controller->request->params['action'] = 'index';
$ScaffoldView = new TestScaffoldView($this->Controller);
$result = $ScaffoldView->testGetFilename('index');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'index.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('edit');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'form.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'form.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('add');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'form.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'form.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('view');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'view.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'view.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('admin_index');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'index.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('admin_view');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'view.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'view.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('admin_edit');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'form.ctp';
$expected =LIBS . 'View' . DS . 'scaffolds' . DS . 'form.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('admin_add');
$expected = LIBS . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'form.ctp';
$expected = LIBS . 'View' . DS . 'scaffolds' . DS . 'form.ctp';
$this->assertEqual($result, $expected);

$result = $ScaffoldView->testGetFilename('error');
$expected = CAKE . 'libs' . DS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
$expected = LIBS . 'View' . DS . 'errors' . DS . 'scaffold_error.ctp';
$this->assertEqual($result, $expected);

$Controller = new ScaffoldMockController($this->request);
Expand Down

0 comments on commit 4e1fcbe

Please sign in to comment.