3 namespace Drupal\Tests\Core\Config;
5 use Drupal\Tests\UnitTestCase;
6 use Drupal\Core\Config\CachedStorage;
7 use Drupal\Core\Cache\NullBackend;
10 * Tests the interaction of cache and file storage in CachedStorage.
14 class CachedStorageTest extends UnitTestCase {
17 * @var \Drupal\Core\Cache\CacheFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
19 protected $cacheFactory;
22 * Test listAll static cache.
24 public function testListAllStaticCache() {
25 $prefix = __FUNCTION__;
26 $storage = $this->getMock('Drupal\Core\Config\StorageInterface');
28 $response = ["$prefix." . $this->randomMachineName(), "$prefix." . $this->randomMachineName()];
29 $storage->expects($this->once())
32 ->will($this->returnValue($response));
34 $cache = new NullBackend(__FUNCTION__);
36 $cachedStorage = new CachedStorage($storage, $cache);
37 $this->assertEquals($response, $cachedStorage->listAll($prefix));
38 $this->assertEquals($response, $cachedStorage->listAll($prefix));