function ModuleHandlerTest::testResetImplementations
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testResetImplementations()
- 8.9.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testResetImplementations()
Tests internal implementation cache reset.
@covers ::resetImplementations
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 501
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Core\ExtensionCode
public function testResetImplementations() : void {
$module_handler = $this->getModuleHandler();
// Prime caches
$module_handler->invokeAllWith('hook', function (callable $hook, string $module) {
});
$module_handler->getHookInfo();
// Reset all caches internal and external.
$this->cacheBackend
->expects($this->once())
->method('delete')
->with('hook_info');
$this->cacheBackend
->expects($this->exactly(2))
->method('set')
->with($this->logicalOr('module_implements', 'hook_info'));
$module_handler->resetImplementations();
// Request implementation and ensure hook_info and module_implements skip
// local caches.
$this->cacheBackend
->expects($this->exactly(2))
->method('get')
->with($this->logicalOr('module_implements', 'hook_info'));
$module_handler->invokeAllWith('hook', function (callable $hook, string $module) {
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.