/**
   * Sets up a memory-based render cache back-end.
   */
  protected function setupMemoryCache() {
    $this->memoryCache = $this->memoryCache ?: new MemoryBackend('render');

    $this->cacheFactory->expects($this->atLeastOnce())
      ->method('get')
      ->with('render')
      ->willReturn($this->memoryCache);
  }
 /**
  * Test file storage on a cache hit in CachedStorage::read().
  */
 public function testReadNonExistentFileCached()
 {
     $name = 'config.does_not_exist';
     $cache = new MemoryBackend(__FUNCTION__);
     $cache->set($name, FALSE);
     $storage = $this->getMock('Drupal\\Core\\Config\\StorageInterface');
     $storage->expects($this->never())->method('read');
     $this->cacheFactory->expects($this->once())->method('get')->with('config')->will($this->returnValue($cache));
     $cachedStorage = new CachedStorage($storage, $this->cacheFactory);
     $this->assertFalse($cachedStorage->read($name));
 }