public function CacheCollectorTest::testUpdateCacheReset in Drupal 8
Tests a reset of the cache collector.
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheCollectorTest.php, line 343
Class
- CacheCollectorTest
- @coversDefaultClass \Drupal\Core\Cache\CacheCollector @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public function testUpdateCacheReset() {
$key = $this
->randomMachineName();
$value = $this
->randomMachineName();
// Set the data and request it.
$this->collector
->setCacheMissData($key, $value);
$this
->assertEquals($value, $this->collector
->get($key));
$this
->assertEquals($value, $this->collector
->get($key));
// Should have been added to the storage and only be requested once.
$this
->assertEquals(1, $this->collector
->getCacheMisses());
// Reset the collected cache, should call it again.
$this->collector
->reset();
$this
->assertEquals($value, $this->collector
->get($key));
$this
->assertEquals(2, $this->collector
->getCacheMisses());
}