本文整理汇总了PHP中Twig_Environment::method方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Environment::method方法的具体用法?PHP Twig_Environment::method怎么用?PHP Twig_Environment::method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Environment
的用法示例。
在下文中一共展示了Twig_Environment::method方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEnvironment
public function getEnvironment()
{
if (is_null($this->environment)) {
$this->environment = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock();
$this->environment->method('loadTemplate')->willReturn($this->getTemplate());
}
return $this->environment;
}
示例2: testRenderEditor
/**
* @dataProvider getRenderEditorTestData
*
* @param array $contents
* @param array $separateContents
* @param string $message
*/
public function testRenderEditor($contents, $separateContents, $message = '')
{
$this->twig->method('render')->will($this->returnValueMap([['@IvoazContentEditable/editor.html.twig', [], '<p>editor</p>'], ['@IvoazContentEditable/separately_editable_contents.html.twig', ['contents' => $separateContents], '<p>separate contents</p>']]));
foreach ($contents as $content) {
$this->editor->renderContent($content, []);
}
foreach ($separateContents as $content) {
$this->editor->renderContent($content, ['separately' => true]);
}
$html = $this->editor->renderEditor(new Response());
$expectedHtml = empty($separateContents) ? '<p>editor</p>' : '<p>separate contents</p><p>editor</p>';
$this->assertSame($expectedHtml, $html, $message);
}