function ModuleHandlerTest::testWriteCache

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testWriteCache()
  2. 8.9.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testWriteCache()

Tests that write cache calls through to cache library correctly.

@covers ::writeCache

File

core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php, line 453

Class

ModuleHandlerTest
@coversDefaultClass \Drupal\Core\Extension\ModuleHandler @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Core\Extension

Code

public function testWriteCache() : void {
    $module_handler = $this->getModuleHandler();
    $this->cacheBackend
        ->expects($this->exactly(2))
        ->method('get')
        ->willReturn(NULL);
    $this->cacheBackend
        ->expects($this->exactly(2))
        ->method('set')
        ->with($this->logicalOr('module_implements', 'hook_info'));
    $module_handler->invokeAllWith('hook', function (callable $hook, string $module) {
    });
    $module_handler->writeCache();
}

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