function PreWarmerTest::testPreWarmOneCache

Tests prewarming one cache at a time.

File

core/tests/Drupal/KernelTests/Core/PreWarm/PreWarmerTest.php, line 28

Class

PreWarmerTest
Tests the cache prewarmer.

Namespace

Drupal\KernelTests\Core\PreWarm

Code

public function testPreWarmOneCache() : void {
    $prewarmer = \Drupal::service('cache_prewarmer');
    // Make sure at least one prewarmable service actually gets called.
    $called = FALSE;
    while ($prewarmer->preWarmOneCache()) {
        $called = TRUE;
    }
    $this->assertTrue($called);
    $this->assertFalse($prewarmer->preWarmOneCache());
}

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