本文整理匯總了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);
}