mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Increasing code coverage for View and ThemeView
This commit is contained in:
parent
948f6b21e5
commit
f83a024a10
3 changed files with 12 additions and 12 deletions
|
@ -67,11 +67,8 @@ class ThemeView extends View {
|
||||||
}
|
}
|
||||||
$paths = array_merge($themePaths, $paths);
|
$paths = array_merge($themePaths, $paths);
|
||||||
}
|
}
|
||||||
|
$this->__paths = $paths;
|
||||||
if (empty($this->__paths)) {
|
return $this->__paths;
|
||||||
$this->__paths = $paths;
|
|
||||||
}
|
|
||||||
return $paths;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -609,7 +609,7 @@ class View extends Object {
|
||||||
function entity() {
|
function entity() {
|
||||||
$assoc = ($this->association) ? $this->association : $this->model;
|
$assoc = ($this->association) ? $this->association : $this->model;
|
||||||
if (!empty($this->entityPath)) {
|
if (!empty($this->entityPath)) {
|
||||||
$path = explode('.',$this->entityPath);
|
$path = explode('.', $this->entityPath);
|
||||||
$count = count($path);
|
$count = count($path);
|
||||||
if (
|
if (
|
||||||
($count == 1 && !empty($this->association)) ||
|
($count == 1 && !empty($this->association)) ||
|
||||||
|
@ -944,12 +944,8 @@ class View extends Object {
|
||||||
}
|
}
|
||||||
$paths[] = App::pluginPath($plugin) . 'views' . DS;
|
$paths[] = App::pluginPath($plugin) . 'views' . DS;
|
||||||
}
|
}
|
||||||
$paths = array_merge($paths, $viewPaths);
|
$this->__paths = array_merge($paths, $viewPaths);
|
||||||
|
return $this->__paths;
|
||||||
if (empty($this->__paths)) {
|
|
||||||
$this->__paths = $paths;
|
|
||||||
}
|
|
||||||
return $paths;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -477,6 +477,13 @@ class ViewTest extends CakeTestCase {
|
||||||
$result = $this->View->element('test_element');
|
$result = $this->View->element('test_element');
|
||||||
$this->assertEqual($result, 'this is the test element');
|
$this->assertEqual($result, 'this is the test element');
|
||||||
|
|
||||||
|
$result = $this->View->element('plugin_element', array('plugin' => 'test_plugin'));
|
||||||
|
$this->assertEqual($result, 'this is the plugin element using params[plugin]');
|
||||||
|
|
||||||
|
$this->View->plugin = 'test_plugin';
|
||||||
|
$result = $this->View->element('test_plugin_element');
|
||||||
|
$this->assertEqual($result, 'this is the test set using View::$plugin plugin element');
|
||||||
|
|
||||||
$result = $this->View->element('non_existant_element');
|
$result = $this->View->element('non_existant_element');
|
||||||
$this->assertPattern('/Not Found:/', $result);
|
$this->assertPattern('/Not Found:/', $result);
|
||||||
$this->assertPattern('/non_existant_element/', $result);
|
$this->assertPattern('/non_existant_element/', $result);
|
||||||
|
|
Loading…
Reference in a new issue