function HelpTopicTwigTest::getTwigMock
Same name in other branches
- 9 core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigTest::getTwigMock()
- 8.9.x core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigTest::getTwigMock()
- 10 core/modules/help/tests/src/Unit/HelpTopicTwigTest.php \Drupal\Tests\help\Unit\HelpTopicTwigTest::getTwigMock()
Creates a mock Twig loader class for the test.
1 call to HelpTopicTwigTest::getTwigMock()
- HelpTopicTwigTest::setUp in core/
modules/ help/ tests/ src/ Unit/ HelpTopicTwigTest.php
File
-
core/
modules/ help/ tests/ src/ Unit/ HelpTopicTwigTest.php, line 97
Class
- HelpTopicTwigTest
- Unit test for the HelpTopicTwig class.
Namespace
Drupal\Tests\help\UnitCode
protected function getTwigMock() {
$twig = $this->getMockBuilder('Drupal\\Core\\Template\\TwigEnvironment')
->disableOriginalConstructor()
->getMock();
$template = $this->getMockBuilder(StubTwigTemplate::class)
->onlyMethods([
'render',
])
->setConstructorArgs([
$twig,
])
->getMock();
$template->method('render')
->willReturn(self::PLUGIN_INFORMATION['body']);
$twig->method('load')
->willReturn(new TemplateWrapper($twig, $template));
return $twig;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.