function CachePreWarmerTest::setupCacheServices
3 calls to CachePreWarmerTest::setupCacheServices()
- CachePreWarmerTest::testPreWarmAll in core/
tests/ Drupal/ Tests/ Core/ PreWarm/ CachePreWarmerTest.php - @covers ::preWarmAllCaches
- CachePreWarmerTest::testPreWarmByOne in core/
tests/ Drupal/ Tests/ Core/ PreWarm/ CachePreWarmerTest.php - @covers ::preWarmOneCache
- CachePreWarmerTest::testPreWarmOnlyOne in core/
tests/ Drupal/ Tests/ Core/ PreWarm/ CachePreWarmerTest.php - @covers ::preWarmOneCache
File
-
core/
tests/ Drupal/ Tests/ Core/ PreWarm/ CachePreWarmerTest.php, line 40
Class
- CachePreWarmerTest
- @coversDefaultClass \Drupal\Core\PreWarm\CachePreWarmer @group PreWarm
Namespace
Drupal\Tests\Core\PreWarmCode
protected function setupCacheServices() : void {
$this->classResolver = $this->createMock(ClassResolverInterface::class);
$this->warmedMap = new \SplObjectStorage();
for ($i = 0; $i < 4; $i++) {
$serviceId = 'service' . $i;
$serviceMock = $this->createMock(PrewarmableInterface::class);
$this->warmedMap[$serviceMock] = 0;
$serviceMock->method('preWarm')
->willReturnCallback(function () use ($serviceMock) {
$this->warmedMap[$serviceMock] = 1 + $this->warmedMap[$serviceMock];
});
$returnMap[] = [
$serviceId,
$serviceMock,
];
}
$this->classResolver
->method('getInstanceFromDefinition')
->willReturnMap($returnMap);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.