function ModuleHandlerTest::testCachedGetImplementationsMissingMethod
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testCachedGetImplementationsMissingMethod()
- 10 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testCachedGetImplementationsMissingMethod()
Test getImplementations.
@covers ::getImplementations @covers ::getImplementationInfo
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 375
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Core\ExtensionCode
public function testCachedGetImplementationsMissingMethod() {
$this->cacheBackend
->expects($this->exactly(1))
->method('get')
->will($this->onConsecutiveCalls((object) [
'data' => [
'hook' => [
'module_handler_test' => [],
'module_handler_test_missing' => [],
],
],
]));
// Ensure buildImplementationInfo doesn't get called and that we work off cached results.
$module_handler = $this->getMockBuilder(ModuleHandler::class)
->setConstructorArgs([
$this->root,
[
'module_handler_test' => [
'type' => 'module',
'pathname' => 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.info.yml',
'filename' => 'module_handler_test.module',
],
],
$this->cacheBackend,
])
->setMethods([
'buildImplementationInfo',
])
->getMock();
$module_handler->load('module_handler_test');
$module_handler->expects($this->never())
->method('buildImplementationInfo');
$this->assertEquals([
'module_handler_test',
], $module_handler->getImplementations('hook'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.