public function ModuleHandlerTest::testResetImplementations in Drupal 8
Test internal implementation cache reset.
@covers ::resetImplementations
File
- core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleHandlerTest.php, line 471
Class
- ModuleHandlerTest
- @coversDefaultClass \Drupal\Core\Extension\ModuleHandler @runTestsInSeparateProcesses
Namespace
Drupal\Tests\Core\ExtensionCode
public function testResetImplementations() {
$module_handler = $this
->getModuleHandler();
// Prime caches
$module_handler
->getImplementations('hook');
$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
->getImplementations('hook');
}