Skip to content

Commit

Permalink
Increasing code coverage for View and ThemeView
Browse files Browse the repository at this point in the history
  • Loading branch information
phpnut committed Nov 26, 2009
1 parent 948f6b2 commit f83a024
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
7 changes: 2 additions & 5 deletions cake/libs/view/theme.php
Expand Up @@ -67,11 +67,8 @@ function _paths($plugin = null, $cached = true) {
}
$paths = array_merge($themePaths, $paths);
}

if (empty($this->__paths)) {
$this->__paths = $paths;
}
return $paths;
$this->__paths = $paths;
return $this->__paths;
}
}
?>
10 changes: 3 additions & 7 deletions cake/libs/view/view.php
Expand Up @@ -609,7 +609,7 @@ function uuid($object, $url) {
function entity() {
$assoc = ($this->association) ? $this->association : $this->model;
if (!empty($this->entityPath)) {
$path = explode('.',$this->entityPath);
$path = explode('.', $this->entityPath);
$count = count($path);
if (
($count == 1 && !empty($this->association)) ||
Expand Down Expand Up @@ -944,12 +944,8 @@ function _paths($plugin = null, $cached = true) {
}
$paths[] = App::pluginPath($plugin) . 'views' . DS;
}
$paths = array_merge($paths, $viewPaths);

if (empty($this->__paths)) {
$this->__paths = $paths;
}
return $paths;
$this->__paths = array_merge($paths, $viewPaths);
return $this->__paths;
}
}

Expand Down
7 changes: 7 additions & 0 deletions cake/tests/cases/libs/view/view.test.php
Expand Up @@ -476,6 +476,13 @@ function testAddInlineScripts() {
function testElement() {
$result = $this->View->element('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');
$this->assertPattern('/Not Found:/', $result);
Expand Down

0 comments on commit f83a024

Please sign in to comment.