Skip to content
Permalink
Browse files

Allow Cell::render() method to work with relative directories.

Refs #3945
  • Loading branch information...
markstory committed Jul 23, 2014
1 parent 2959a17 commit e64e01af5e76065d4ae06bac1b802d5d37a382ab
Showing with 13 additions and 2 deletions.
  1. +2 −2 src/View/Cell.php
  2. +11 −0 tests/TestCase/View/CellTest.php
@@ -134,10 +134,10 @@ public function __construct(Request $request = null, Response $response = null,
* @return void
*/
public function render($template = null) {
if ($template !== null) {
if ($template !== null && strpos($template, '/') === false) {
$template = Inflector::underscore($template);
}
if (empty($template)) {
if ($template === null) {
$template = $this->template;
}
@@ -168,6 +168,17 @@ public function testPluginCellAlternateTemplate() {
$this->assertContains('This is a translatable string', "{$cell}");
}
/**
* Test that plugin cells can render other view templates.
*
* @return void
*/
public function testPluginCellAlternateTemplateRenderParam() {
$cell = $this->View->cell('TestPlugin.Dummy::echoThis', ['msg' => 'hello world!']);
$result = $cell->render('../../Element/translate');
$this->assertContains('This is a translatable string', $result);
}
/**
* Tests that using an unexisting cell throws an exception.
*

0 comments on commit e64e01a

Please sign in to comment.
You can’t perform that action at this time.