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. 10 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testWriteCache()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testWriteCache()

Test that write cache calls through to cache library correctly.

@covers ::writeCache

File

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

Class

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

Namespace

Drupal\Tests\Core\Extension

Code

public function testWriteCache() {
    $module_handler = $this->getModuleHandler();
    $this->cacheBackend
        ->expects($this->exactly(2))
        ->method('get')
        ->will($this->returnValue(NULL));
    $this->cacheBackend
        ->expects($this->exactly(2))
        ->method('set')
        ->with($this->logicalOr('module_implements', 'hook_info'));
    $module_handler->getImplementations('hook');
    $module_handler->writeCache();
}

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