public function CacheCollectorTest::testGetFromCache in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php \Drupal\Tests\Core\Cache\CacheCollectorTest::testGetFromCache()
Tests returning value from the collected cache.
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheCollectorTest.php, line 118 - Contains \Drupal\Tests\Core\Cache\CacheCollectorTest.
Class
- CacheCollectorTest
- @coversDefaultClass \Drupal\Core\Cache\CacheCollector @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public function testGetFromCache() {
$key = $this
->randomMachineName();
$value = $this
->randomMachineName();
$cache = (object) array(
'data' => array(
$key => $value,
),
'created' => (int) $_SERVER['REQUEST_TIME'],
);
$this->cacheBackend
->expects($this
->once())
->method('get')
->with($this->cid)
->will($this
->returnValue($cache));
$this
->assertTrue($this->collector
->has($key));
$this
->assertEquals($value, $this->collector
->get($key));
$this
->assertEquals(0, $this->collector
->getCacheMisses());
}