mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
adding tests for plugindot syntax in view filenames
This commit is contained in:
parent
a72ccf28e3
commit
210f8c9e2c
1 changed files with 32 additions and 0 deletions
|
@ -322,6 +322,24 @@ class ViewTest extends CakeTestCase {
|
|||
$result = $View->getLayoutFileName();
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
|
||||
$result = $View->getViewFileName('TestPlugin.home');
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
CakePlugin::load('TestPlugin');
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
|
||||
$result = $View->getViewFileName('TestPlugin.home');
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$View->viewPath = 'Tests';
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS .'Tests' . DS .'index.ctp';
|
||||
$result = $View->getViewFileName('TestPlugin.index');
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layouts' . DS .'default.ctp';
|
||||
$result = $View->getLayoutFileName('TestPlugin.default');
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$View->layoutPath = 'rss';
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Layouts' . DS . 'rss' . DS . 'default.ctp';
|
||||
$result = $View->getLayoutFileName();
|
||||
|
@ -423,6 +441,13 @@ class ViewTest extends CakeTestCase {
|
|||
$result = $this->View->element('plugin_element', array(), array('plugin' => 'test_plugin'));
|
||||
$this->assertEquals($result, 'this is the plugin element using params[plugin]');
|
||||
|
||||
$result = $this->View->element('TestPlugin.plugin_element');
|
||||
$this->assertEqual($result, 'this is the plugin element using params[plugin]');
|
||||
|
||||
$result = $this->View->element('test_plugin.plugin_element');
|
||||
$this->assertPattern('/Not Found:/', $result);
|
||||
$this->assertPattern('/test_plugin.plugin_element/', $result);
|
||||
|
||||
$this->View->plugin = 'TestPlugin';
|
||||
$result = $this->View->element('test_plugin_element');
|
||||
$this->assertEquals($result, 'this is the test set using View::$plugin plugin element');
|
||||
|
@ -430,6 +455,10 @@ class ViewTest extends CakeTestCase {
|
|||
$result = $this->View->element('non_existant_element');
|
||||
$this->assertRegExp('/Not Found:/', $result);
|
||||
$this->assertRegExp('/non_existant_element/', $result);
|
||||
|
||||
$result = $this->View->element('TestPlugin.plugin_element', array(), array('plugin' => 'test_plugin'));
|
||||
$this->assertRegExp('/Not Found:/', $result);
|
||||
$this->assertRegExp('/TestPlugin.plugin_element/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -747,6 +776,9 @@ class ViewTest extends CakeTestCase {
|
|||
$result = $View->getViewFileName('index');
|
||||
$this->assertRegExp('/Posts(\/|\\\)index.ctp/', $result);
|
||||
|
||||
$result = $View->getViewFileName('TestPlugin.index');
|
||||
$this->assertPattern('/Posts(\/|\\\)index.ctp/', $result);
|
||||
|
||||
$result = $View->getViewFileName('/Pages/home');
|
||||
$this->assertRegExp('/Pages(\/|\\\)home.ctp/', $result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue