|
|
@@ -348,32 +348,32 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$ThemeView = new TestView(null, null, null, $viewOptions);
|
|
|
$ThemeView->theme = 'TestTheme';
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Pages' . DS . 'home.ctp';
|
|
|
$result = $ThemeView->getViewFileName('home');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = Plugin::path('TestTheme') . 'src' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
+ $expected = Plugin::path('TestTheme') . 'templates' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
$result = $ThemeView->getViewFileName('/Posts/index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = Plugin::path('TestTheme') . 'src' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = Plugin::path('TestTheme') . 'templates' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $ThemeView->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$ThemeView->layoutPath = 'rss';
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
|
|
|
$result = $ThemeView->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$ThemeView->layoutPath = 'Email' . DS . 'html';
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
|
|
|
$result = $ThemeView->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$ThemeView = new TestView(null, null, null, $viewOptions);
|
|
|
|
|
|
$ThemeView->theme = 'Company/TestPluginThree';
|
|
|
- $expected = Plugin::path('Company/TestPluginThree') . 'src' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = Plugin::path('Company/TestPluginThree') . 'templates' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $ThemeView->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
@@ -393,11 +393,11 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$View = new TestView(null, null, null, $viewOptions);
|
|
|
|
|
|
- $expected = Plugin::path('TestPlugin') . 'src' . DS . 'Template' . DS . 'Tests' . DS . 'index.ctp';
|
|
|
+ $expected = Plugin::path('TestPlugin') . 'templates' . DS . 'Tests' . DS . 'index.ctp';
|
|
|
$result = $View->getViewFileName('index');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
- $expected = Plugin::path('TestPlugin') . 'src' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = Plugin::path('TestPlugin') . 'templates' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
@@ -418,7 +418,7 @@ class ViewTest extends TestCase
|
|
|
];
|
|
|
|
|
|
$view = new TestView(null, null, null, $viewOptions);
|
|
|
- $expected = TEST_APP . 'Plugin' . DS . 'Company' . DS . 'TestPluginThree' . DS . 'src' . DS . 'Template' . DS . 'Pages' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'Plugin' . DS . 'Company' . DS . 'TestPluginThree' . DS . 'templates' . DS . 'Pages' . DS . 'index.ctp';
|
|
|
$result = $view->getViewFileName('Company/TestPluginThree./Pages/index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
@@ -440,7 +440,7 @@ class ViewTest extends TestCase
|
|
|
];
|
|
|
|
|
|
$ThemeView = new TestView(null, null, null, $viewOptions);
|
|
|
- $themePath = Plugin::path('TestTheme') . 'src' . DS . 'Template' . DS;
|
|
|
+ $themePath = Plugin::path('TestTheme') . 'templates' . DS;
|
|
|
|
|
|
$expected = $themePath . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS . 'index.ctp';
|
|
|
$result = $ThemeView->getViewFileName('index');
|
|
|
@@ -476,10 +476,10 @@ class ViewTest extends TestCase
|
|
|
$paths = $View->paths('TestPlugin');
|
|
|
$pluginPath = Plugin::path('TestPlugin');
|
|
|
$expected = [
|
|
|
- TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
- $pluginPath . 'src' . DS . 'Template' . DS,
|
|
|
- TEST_APP . 'TestApp' . DS . 'Template' . DS,
|
|
|
- CAKE . 'Template' . DS,
|
|
|
+ TEST_APP . 'templates' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
+ $pluginPath . 'templates' . DS,
|
|
|
+ TEST_APP . 'templates' . DS,
|
|
|
+ CORE_PATH . 'templates' . DS,
|
|
|
];
|
|
|
$this->assertPathEquals($expected, $paths);
|
|
|
}
|
|
|
@@ -503,12 +503,12 @@ class ViewTest extends TestCase
|
|
|
$pluginPath = Plugin::path('TestPlugin');
|
|
|
$themePath = Plugin::path('TestTheme');
|
|
|
$expected = [
|
|
|
- $themePath . 'src' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
- $themePath . 'src' . DS . 'Template' . DS,
|
|
|
- TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
- $pluginPath . 'src' . DS . 'Template' . DS,
|
|
|
- TEST_APP . 'TestApp' . DS . 'Template' . DS,
|
|
|
- CAKE . 'Template' . DS,
|
|
|
+ $themePath . 'templates' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
+ $themePath . 'templates' . DS,
|
|
|
+ TEST_APP . 'templates' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
+ $pluginPath . 'templates' . DS,
|
|
|
+ TEST_APP . 'templates' . DS,
|
|
|
+ CORE_PATH . 'templates' . DS,
|
|
|
];
|
|
|
$this->assertPathEquals($expected, $paths);
|
|
|
}
|
|
|
@@ -528,7 +528,7 @@ class ViewTest extends TestCase
|
|
|
];
|
|
|
|
|
|
$paths = Configure::read('App.paths.templates');
|
|
|
- $paths[] = Plugin::classPath('TestPlugin') . 'Template' . DS;
|
|
|
+ $paths[] = Plugin::path('TestPlugin') . 'templates' . DS;
|
|
|
Configure::write('App.paths.templates', $paths);
|
|
|
|
|
|
$View = new TestView(null, null, null, $viewOptions);
|
|
|
@@ -536,14 +536,14 @@ class ViewTest extends TestCase
|
|
|
$pluginPath = Plugin::path('TestPlugin');
|
|
|
$themePath = Plugin::path('TestTheme');
|
|
|
$expected = [
|
|
|
- $themePath . 'src' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
- $themePath . 'src' . DS . 'Template' . DS,
|
|
|
- TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
- $pluginPath . 'src' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
- $pluginPath . 'src' . DS . 'Template' . DS,
|
|
|
- TEST_APP . 'TestApp' . DS . 'Template' . DS,
|
|
|
- TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS . 'Template' . DS,
|
|
|
- CAKE . 'Template' . DS,
|
|
|
+ $themePath . 'templates' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
+ $themePath . 'templates' . DS,
|
|
|
+ TEST_APP . 'templates' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
+ $pluginPath . 'templates' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
|
|
|
+ $pluginPath . 'templates' . DS,
|
|
|
+ TEST_APP . 'templates' . DS,
|
|
|
+ TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'templates' . DS,
|
|
|
+ CORE_PATH . 'templates' . DS
|
|
|
];
|
|
|
$this->assertPathEquals($expected, $paths);
|
|
|
}
|
|
|
@@ -564,12 +564,12 @@ class ViewTest extends TestCase
|
|
|
$View = new TestView(null, null, null, $viewOptions);
|
|
|
|
|
|
$pluginPath = Plugin::path('TestPlugin');
|
|
|
- $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS .
|
|
|
- 'Template' . DS . 'Tests' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'templates' . DS .
|
|
|
+ 'Tests' . DS . 'index.ctp';
|
|
|
$result = $View->getViewFileName('index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = $pluginPath . 'src' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = $pluginPath . 'templates' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
@@ -591,30 +591,30 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$View = new TestView(null, null, null, $viewOptions);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Pages' . DS . 'home.ctp';
|
|
|
$result = $View->getViewFileName('home');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
$result = $View->getViewFileName('/Posts/index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
$result = $View->getViewFileName('../Posts/index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'page.home.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Pages' . DS . 'page.home.ctp';
|
|
|
$result = $View->getViewFileName('page.home');
|
|
|
$this->assertPathEquals($expected, $result, 'Should not ruin files with dots.');
|
|
|
|
|
|
Plugin::load('TestPlugin');
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Pages' . DS . 'home.ctp';
|
|
|
$result = $View->getViewFileName('TestPlugin.home');
|
|
|
$this->assertPathEquals($expected, $result, 'Plugin is missing the view, cascade to app.');
|
|
|
|
|
|
$View->setTemplatePath('Tests');
|
|
|
- $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS .
|
|
|
- 'Template' . DS . 'Tests' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'templates' . DS .
|
|
|
+ 'Tests' . DS . 'index.ctp';
|
|
|
$result = $View->getViewFileName('TestPlugin.index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
@@ -637,7 +637,7 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$view = new TestView(null, null, null, $viewOptions);
|
|
|
$view->ext('.php');
|
|
|
- $view->getViewFileName('../../../../bootstrap');
|
|
|
+ $view->getViewFileName('../../../bootstrap');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -655,13 +655,13 @@ class ViewTest extends TestCase
|
|
|
];
|
|
|
$view = new TestView(null, null, null, $viewOptions);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'json' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Posts' . DS . 'json' . DS . 'index.ctp';
|
|
|
$result = $view->getViewFileName('index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$view->subDir = 'json';
|
|
|
$result = $view->getViewFileName('index');
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'json' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Posts' . DS . 'json' . DS . 'index.ctp';
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
|
|
|
@@ -682,7 +682,7 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$view->subDir = 'json';
|
|
|
$result = $view->getViewFileName('index');
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Jobs' . DS . 'json' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Jobs' . DS . 'json' . DS . 'index.ctp';
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
|
|
|
@@ -701,17 +701,17 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$View = new TestView(null, null, null, $viewOptions);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$View->layoutPath = 'rss';
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$View->layoutPath = 'Email' . DS . 'html';
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
@@ -732,14 +732,14 @@ class ViewTest extends TestCase
|
|
|
$View = new TestView(null, null, null, $viewOptions);
|
|
|
Plugin::load('TestPlugin');
|
|
|
|
|
|
- $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS .
|
|
|
- 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'templates' . DS .
|
|
|
+ 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName('TestPlugin.default');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
$View->plugin = 'TestPlugin';
|
|
|
- $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'src' . DS .
|
|
|
- 'Template' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
+ $expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'templates' . DS .
|
|
|
+ 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName('default');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
@@ -755,7 +755,7 @@ class ViewTest extends TestCase
|
|
|
|
|
|
// Prefix specific layout
|
|
|
$View->request = $View->request->withParam('prefix', 'foo_prefix');
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS .
|
|
|
+ $expected = TEST_APP . 'templates' . DS .
|
|
|
'FooPrefix' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
@@ -766,19 +766,19 @@ class ViewTest extends TestCase
|
|
|
|
|
|
// Nested prefix layout
|
|
|
$View->request = $View->request->withParam('prefix', 'foo_prefix/bar_prefix');
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS .
|
|
|
+ $expected = TEST_APP . 'templates' . DS .
|
|
|
'FooPrefix' . DS . 'BarPrefix' . DS . 'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS .
|
|
|
+ $expected = TEST_APP . 'templates' . DS .
|
|
|
'FooPrefix' . DS . 'Layout' . DS . 'nested_prefix_cascade.ctp';
|
|
|
$result = $View->getLayoutFileName('nested_prefix_cascade');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
|
|
|
// Fallback to app's layout
|
|
|
$View->request = $View->request->withParam('prefix', 'Admin');
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS .
|
|
|
+ $expected = TEST_APP . 'templates' . DS .
|
|
|
'Layout' . DS . 'default.ctp';
|
|
|
$result = $View->getLayoutFileName();
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
@@ -802,7 +802,7 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$view = new TestView(null, null, null, $viewOptions);
|
|
|
$view->ext('.php');
|
|
|
- $view->getLayoutFileName('../../../../bootstrap');
|
|
|
+ $view->getLayoutFileName('../../../bootstrap');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1424,7 +1424,7 @@ class ViewTest extends TestCase
|
|
|
|
|
|
$pluginPath = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS;
|
|
|
$result = $View->getViewFileName('sub_dir/sub_element');
|
|
|
- $expected = $pluginPath . 'src' . DS . 'Template' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.ctp';
|
|
|
+ $expected = $pluginPath . 'templates' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.ctp';
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|
|
|
|
|
|
@@ -1469,7 +1469,7 @@ class ViewTest extends TestCase
|
|
|
$result = $View->getViewFileName('../Element/test_element');
|
|
|
$this->assertRegExp('/Element(\/|\\\)test_element.ctp/', $result);
|
|
|
|
|
|
- $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
+ $expected = TEST_APP . 'templates' . DS . 'Posts' . DS . 'index.ctp';
|
|
|
$result = $View->getViewFileName('../Posts/index');
|
|
|
$this->assertPathEquals($expected, $result);
|
|
|
}
|