Skip to content

Commit

Permalink
Fix cell paths in plugins not being able to use relative paths.
Browse files Browse the repository at this point in the history
Refs #3945
  • Loading branch information
markstory committed Jul 18, 2014
1 parent ac702ca commit 6ae765c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/View/View.php
Expand Up @@ -852,6 +852,8 @@ protected function _getViewFileName($name = null) {
$name = trim($name, DS);
} elseif (!$plugin || $this->viewPath !== $this->name) {
$name = $this->viewPath . DS . $subDir . $name;
} else {
$name = DS . $subDir . $name;
}
}

Expand Down
11 changes: 11 additions & 0 deletions tests/TestCase/View/CellTest.php
Expand Up @@ -157,6 +157,17 @@ public function testPluginCell() {
$this->assertContains('hello world!', "{$cell}");
}

/**
* Test that plugin cells can render other view templates.
*
* @return void
*/
public function testPluginCellAlternateTemplate() {
$cell = $this->View->cell('TestPlugin.Dummy::echoThis', ['msg' => 'hello world!']);
$cell->template = '../../Element/translate';
$this->assertContains('This is a translatable string', "{$cell}");
}

/**
* Tests that using an unexisting cell throws an exception.
*
Expand Down

0 comments on commit 6ae765c

Please sign in to comment.