mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Migrating all View package tests to use the new plugin loader
This commit is contained in:
parent
0573037f2c
commit
a45758cc7d
6 changed files with 13 additions and 6 deletions
|
@ -253,7 +253,7 @@ class Helper extends Object {
|
|||
$themePath = App::themePath($theme) . 'webroot' . DS . implode(DS, $segments);
|
||||
return $path . '?' . @filemtime($themePath);
|
||||
} else {
|
||||
$plugin = $segments[0];
|
||||
$plugin = Inflector::camelize($segments[0]);
|
||||
unset($segments[0]);
|
||||
$pluginPath = App::pluginPath($plugin) . 'webroot' . DS . implode(DS, $segments);
|
||||
return $path . '?' . @filemtime($pluginPath);
|
||||
|
|
|
@ -44,6 +44,7 @@ class HelperCollectionTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function teardown() {
|
||||
CakePlugin::unload();
|
||||
unset($this->Helpers, $this->View);
|
||||
}
|
||||
|
||||
|
@ -82,6 +83,7 @@ class HelperCollectionTest extends CakeTestCase {
|
|||
$this->assertInstanceOf('HtmlAliasHelper', $result);
|
||||
|
||||
App::build(array('plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)));
|
||||
CakePlugin::loadAll();
|
||||
$result = $this->Helpers->load('SomeOther', array('className' => 'TestPlugin.OtherHelper'));
|
||||
$this->assertInstanceOf('OtherHelperHelper', $result);
|
||||
$this->assertInstanceOf('OtherHelperHelper', $this->Helpers->SomeOther);
|
||||
|
@ -123,6 +125,7 @@ class HelperCollectionTest extends CakeTestCase {
|
|||
App::build(array(
|
||||
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
|
||||
));
|
||||
CakePlugin::loadAll();
|
||||
$result = $this->Helpers->load('TestPlugin.OtherHelper');
|
||||
$this->assertInstanceOf('OtherHelperHelper', $result, 'Helper class is wrong.');
|
||||
$this->assertInstanceOf('OtherHelperHelper', $this->Helpers->OtherHelper, 'Class is wrong');
|
||||
|
|
|
@ -216,6 +216,7 @@ class HelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
CakePlugin::unload();
|
||||
unset($this->Helper, $this->View);
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
@ -520,6 +521,7 @@ class HelperTest extends CakeTestCase {
|
|||
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
|
||||
'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS),
|
||||
));
|
||||
CakePlugin::loadAll();
|
||||
|
||||
$result = $this->Helper->assetTimestamp('/test_plugin/css/test_plugin_asset.css');
|
||||
$this->assertPattern('#/test_plugin/css/test_plugin_asset.css\?[0-9]+$#', $result, 'Missing timestamp plugin');
|
||||
|
|
|
@ -120,6 +120,7 @@ class ThemeViewTest extends CakeTestCase {
|
|||
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
|
||||
'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'View'. DS)
|
||||
));
|
||||
CakePlugin::loadAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,6 +135,7 @@ class ThemeViewTest extends CakeTestCase {
|
|||
unset($this->Controller);
|
||||
ClassRegistry::flush();
|
||||
App::build();
|
||||
CakePlugin::unload();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,18 +145,18 @@ class ThemeViewTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testPluginThemedGetTemplate() {
|
||||
$this->Controller->plugin = 'test_plugin';
|
||||
$this->Controller->plugin = 'TestPlugin';
|
||||
$this->Controller->name = 'TestPlugin';
|
||||
$this->Controller->viewPath = 'tests';
|
||||
$this->Controller->action = 'index';
|
||||
$this->Controller->theme = 'test_theme';
|
||||
|
||||
$ThemeView = new TestThemeView($this->Controller);
|
||||
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'test_plugin' . DS . 'tests' . DS .'index.ctp';
|
||||
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'TestPlugin' . DS . 'tests' . DS .'index.ctp';
|
||||
$result = $ThemeView->getViewFileName('index');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'test_plugin' . DS . 'layouts' . DS .'plugin_default.ctp';
|
||||
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'TestPlugin' . DS . 'layouts' . DS .'plugin_default.ctp';
|
||||
$result = $ThemeView->getLayoutFileName('plugin_default');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
@ -195,8 +197,8 @@ class ThemeViewTest extends CakeTestCase {
|
|||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$ThemeView->layoutPath = 'email' . DS . 'html';
|
||||
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS . 'layouts' . DS . 'email' . DS . 'html' . DS . 'default.ctp';
|
||||
$ThemeView->layoutPath = 'emails' . DS . 'html';
|
||||
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'View' . DS . 'layouts' . DS . 'emails' . DS . 'html' . DS . 'default.ctp';
|
||||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue