You are here

protected function HelpTopicTwigTest::getTwigMock in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigTest::getTwigMock()

Creates a mock Twig loader class for the test.

1 call to HelpTopicTwigTest::getTwigMock()
HelpTopicTwigTest::setUp in core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php

File

core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php, line 91

Class

HelpTopicTwigTest
Unit test for the HelpTopicTwig class.

Namespace

Drupal\Tests\help_topics\Unit

Code

protected function getTwigMock() {
  $twig = $this
    ->getMockBuilder('Drupal\\Core\\Template\\TwigEnvironment')
    ->disableOriginalConstructor()
    ->getMock();
  $twig
    ->method('load')
    ->willReturn(new FakeTemplateWrapper(self::PLUGIN_INFORMATION['body']));
  return $twig;
}