Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactoring extensions in ScaffoldView to reflect removal of magic .t…

…html extension.

Adding test for interaction of Themed views and Scaffolded views.  Fixes #255
  • Loading branch information...
commit 30cb38eb93b416f53abd946b5a48e2794cf61b70 1 parent 76d6864
@markstory markstory authored
View
12 cake/libs/controller/scaffold.php
@@ -584,11 +584,13 @@ function _getViewFileName($name = null) {
$names[] = 'scaffolds' . DS . $subDir . $name;
$paths = $this->_paths($this->plugin);
-
- $exts = array($this->ext, '.ctp', '.thtml');
- foreach ($paths as $path) {
- foreach ($names as $name) {
- foreach ($exts as $ext) {
+ $exts = array($this->ext);
+ if ($this->ext !== '.ctp') {
+ array_push($exts, '.ctp');
+ }
+ foreach ($exts as $ext) {
+ foreach ($paths as $path) {
+ foreach ($names as $name) {
if (file_exists($path . $name . $ext)) {
return $path . $name . $ext;
}
View
17 cake/tests/cases/libs/controller/scaffold.test.php
@@ -381,6 +381,23 @@ function testGetViewFilename() {
}
/**
+ * test getting the view file name for themed scaffolds.
+ *
+ * @return void
+ */
+ function testGetViewFileNameWithTheme() {
+ $this->Controller->action = 'index';
+ $this->Controller->viewPath = 'posts';
+ $this->Controller->theme = 'test_theme';
+ $ScaffoldView =& new TestScaffoldView($this->Controller);
+
+ $result = $ScaffoldView->testGetFilename('index');
+ $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS
+ . 'themed' . DS . 'test_theme' . DS . 'posts' . DS . 'scaffold.index.ctp';
+ $this->assertEqual($result, $expected);
+ }
+
+/**
* test default index scaffold generation
*
* @access public
Please sign in to comment.
Something went wrong with that request. Please try again.