Skip to content
Snippets Groups Projects
Commit ba035c0a authored by Demian Katz's avatar Demian Katz Committed by Robert Lange
Browse files

TemplateBased ContentBlock: Fix problem with i18n of PHTML templates. (#1836)

parent aaa03516
Branches
Tags
No related merge requests found
......@@ -122,7 +122,7 @@ class TemplateBased implements ContentBlockInterface
protected function getContextForPhtml(string $page, string $path): array
{
return [
'templateName' => $this->templateName,
'templateName' => $page,
];
}
}
......@@ -58,6 +58,24 @@ class TemplateBasedTest extends \PHPUnit\Framework\TestCase
$this->assertEquals(['templateName' => 'foo'], $block->getContext());
}
/**
* Test functionality of .phtml content block w/ i18n.
*
* @return void
*/
public function testI18nPhtmlFunctionality()
{
$locator = $this->getMockBuilder(\VuFind\Content\PageLocator::class)
->disableOriginalConstructor()
->getMock();
$locator->expects($this->once())->method('determineTemplateAndRenderer')
->with($this->equalTo('templates/ContentBlock/TemplateBased/'), $this->equalTo('foo'))
->will($this->returnValue(['renderer' => 'phtml', 'page' => 'foo_en', 'path' => '/path/to/foo_en.phtml']));
$block = new \VuFind\ContentBlock\TemplateBased($locator);
$block->setConfig('foo');
$this->assertEquals(['templateName' => 'foo_en'], $block->getContext());
}
/**
* Test basic functionality of Markdown content block.
*
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment