function HelpTopicTwigTest::getTwigMock

Same name in other branches
  1. 9 core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigTest::getTwigMock()
  2. 10 core/modules/help/tests/src/Unit/HelpTopicTwigTest.php \Drupal\Tests\help\Unit\HelpTopicTwigTest::getTwigMock()
  3. 11.x 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_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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.