function 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());
}