function HelpTopicTwigLoaderTest::getHandlerMock
Same name in other branches
- 8.9.x core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigLoaderTest::getHandlerMock()
Creates a mock module or theme handler class for the test.
Parameters
string $type: Type of handler to return: 'module' or 'theme'.
Return value
\PHPUnit\Framework\MockObject\MockObject The mock of module or theme handler.
1 call to HelpTopicTwigLoaderTest::getHandlerMock()
- HelpTopicTwigLoaderTest::setUp in core/
modules/ help_topics/ tests/ src/ Unit/ HelpTopicTwigLoaderTest.php
File
-
core/
modules/ help_topics/ tests/ src/ Unit/ HelpTopicTwigLoaderTest.php, line 82
Class
- HelpTopicTwigLoaderTest
- Unit test for the HelpTopicTwigLoader class.
Namespace
Drupal\Tests\help_topics\UnitCode
protected function getHandlerMock($type) {
if ($type == 'module') {
$class = 'Drupal\\Core\\Extension\\ModuleHandlerInterface';
$method = 'getModuleDirectories';
}
else {
$class = 'Drupal\\Core\\Extension\\ThemeHandlerInterface';
$method = 'getThemeDirectories';
}
$handler = $this->getMockBuilder($class)
->disableOriginalConstructor()
->getMock();
$handler->method($method)
->willReturn($this->directories[$type]);
return $handler;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.