/** * Test fall through to file storage in CachedStorage::readMultiple(). */ public function testGetMultipleOnPartiallyPrimedCache() { $configNames = array('foo.bar', 'baz.back', 'config.exists_not_cached', 'config.does_not_exist_cached', 'config.does_not_exist'); $configCacheValues = array('foo.bar' => array('foo' => 'bar'), 'baz.back' => array('foo' => 'bar')); $cache = new MemoryBackend(__FUNCTION__); foreach ($configCacheValues as $key => $value) { $cache->set($key, $value); } $cache->set('config.does_not_exist_cached', FALSE); $config_exists_not_cached_data = array('foo' => 'bar'); $response = array($configNames[2] => $config_exists_not_cached_data, $configNames[4] => FALSE); $storage = $this->getMock('Drupal\\Core\\Config\\StorageInterface'); $storage->expects($this->once())->method('readMultiple')->with(array($configNames[2], $configNames[4]))->will($this->returnValue($response)); $cachedStorage = new CachedStorage($storage, $cache); $expected_data = $configCacheValues + array($configNames[2] => $config_exists_not_cached_data); $this->assertEquals($expected_data, $cachedStorage->readMultiple($configNames)); // Ensure that the a missing file is cached. $entry = $cache->get('config.does_not_exist'); $this->assertFalse($entry->data); // Ensure that the a file containing data is cached. $entry = $cache->get('config.exists_not_cached'); $this->assertEquals($config_exists_not_cached_data, $entry->data); }