You are here

public function CacheDataCollectorTest::testCacheCollectorMiss in Devel 8.2

Same name and namespace in other branches
  1. 8.3 webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\CacheDataCollectorTest::testCacheCollectorMiss()
  2. 8 webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\CacheDataCollectorTest::testCacheCollectorMiss()
  3. 4.x webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php \Drupal\Tests\webprofiler\Unit\DataCollector\CacheDataCollectorTest::testCacheCollectorMiss()

Tests the collection of a cache miss.

File

webprofiler/tests/src/Unit/DataCollector/CacheDataCollectorTest.php, line 36

Class

CacheDataCollectorTest
@coversDefaultClass \Drupal\webprofiler\DataCollector\CacheDataCollector

Namespace

Drupal\Tests\webprofiler\Unit\DataCollector

Code

public function testCacheCollectorMiss() {
  $this->cacheBackendInterface
    ->expects($this
    ->once())
    ->method('get')
    ->will($this
    ->returnValue(FALSE));
  $cacheBackendWrapper = new CacheBackendWrapper($this->cacheDataCollector, $this->cacheBackendInterface, 'default');
  $cache = $cacheBackendWrapper
    ->get('cache_id');
  $this
    ->assertFalse($cache);
  $this
    ->assertEquals(1, $this->cacheDataCollector
    ->getCacheMissesCount());
}