mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Refactoring extensions in ScaffoldView to reflect removal of magic .thtml extension.
Adding test for interaction of Themed views and Scaffolded views. Fixes #255
This commit is contained in:
parent
76d6864d90
commit
30cb38eb93
2 changed files with 24 additions and 5 deletions
|
@ -584,11 +584,13 @@ class ScaffoldView extends ThemeView {
|
|||
$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;
|
||||
}
|
||||
|
|
|
@ -380,6 +380,23 @@ class ScaffoldViewTest extends CakeTestCase {
|
|||
Configure::write('Routing.prefixes', $_admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue