public function CacheDataCollectorTest::testCacheCollectorHit in Devel 8.3
Same name and namespace in other branches
- 8 webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\CacheDataCollectorTest::testCacheCollectorHit()
- 8.2 webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\CacheDataCollectorTest::testCacheCollectorHit()
- 4.x webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\CacheDataCollectorTest::testCacheCollectorHit()
Tests the collection of a cache hit.
File
- webprofiler/
tests/ src/ Unit/ DataCollector/ CacheDataCollectorTest.php, line 52
Class
- CacheDataCollectorTest
- @coversDefaultClass \Drupal\webprofiler\DataCollector\CacheDataCollector
Namespace
Drupal\Tests\webprofiler\Unit\DataCollectorCode
public function testCacheCollectorHit() {
$cache = new \stdClass();
$cache->cid = 'cache_id';
$cache->expire = 1;
$cache->tags = [
'tag1',
'tag2',
];
$this->cacheBackendInterface
->expects($this
->once())
->method('get')
->will($this
->returnValue($cache));
$cacheBackendWrapper = new CacheBackendWrapper($this->cacheDataCollector, $this->cacheBackendInterface, 'default');
$cache2 = $cacheBackendWrapper
->get('cache_id');
$this
->assertNotNull($cache2);
$this
->assertEquals(1, $this->cacheDataCollector
->getCacheHitsCount());
}