fixes #4986, .ctp extension failover for layouts

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7260 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-06-25 03:16:53 +00:00
parent c60b232ab4
commit abf3d0685a
2 changed files with 8 additions and 1 deletions

View file

@ -828,7 +828,7 @@ class View extends Object {
foreach ($paths as $path) {
if (file_exists($path . $file . $this->ext)) {
return $path . $file . $this->ext;
} elseif (file_exists($path . $name . '.ctp')) {
} elseif (file_exists($path . $file . '.ctp')) {
return $path . $file . '.ctp';
} elseif (file_exists($path . $file . '.thtml')) {
return $path . $file . '.thtml';

View file

@ -656,6 +656,13 @@ class ViewTest extends CakeTestCase {
$this->assertPattern("/<em>PostsController::<\/em><em>something\(\)<\/em>/", $result);
$this->assertPattern("/posts(\/|\\\)this_is_missing.whatever/", $result);
$this->PostsController->ext = ".bad";
$View = new TestView($this->PostsController);
$result = str_replace(array("\t", "\r\n", "\n"), "", $View->render('index'));
$this->assertPattern("/<meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\" \/><title>/", $result);
$this->assertPattern("/<div id=\"content\">posts index<\/div>/", $result);
}
/**
* tearDown method