diff --git a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php index 9b2dc7f..84604a7 100644 --- a/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php @@ -29,15 +29,17 @@ public static function getInfo() { public function testListAllStaticCache() { $prefix = __FUNCTION__; $storage = $this->getMock('Drupal\Core\Config\StorageInterface'); + + $response = array("$prefix." . $this->randomName(), "$prefix." . $this->randomName()); $storage->expects($this->once()) ->method('listAll') ->with($prefix) - ->will($this->returnValue(array("$prefix.bar", "$prefix.baz"))); + ->will($this->returnValue($response)); $cache = new NullBackend(__FUNCTION__); $cachedStorage = new CachedStorage($storage, $cache); - $cachedStorage->listAll($prefix); - $cachedStorage->listAll($prefix); + $this->assertEquals($response, $cachedStorage->listAll($prefix)); + $this->assertEquals($response, $cachedStorage->listAll($prefix)); } /** @@ -48,10 +50,11 @@ public function testListAllPrimedPersistentCache() { $storage = $this->getMock('Drupal\Core\Config\StorageInterface'); $storage->expects($this->never())->method('listAll'); + $response = array("$prefix." . $this->randomName(), "$prefix." . $this->randomName()); $cache = new MemoryBackend(__FUNCTION__); - $cache->set('list:' . $prefix, array("$prefix.bar", "$prefix.baz")); + $cache->set('list:' . $prefix, $response); $cachedStorage = new CachedStorage($storage, $cache); - $cachedStorage->listAll($prefix); + $this->assertEquals($response, $cachedStorage->listAll($prefix)); } /** @@ -77,7 +80,7 @@ public function testGetMultipleOnPrimedCache() { $cache->set($key, $value); } $cachedStorage = new CachedStorage($storage, $cache); - $cachedStorage->readMultiple($configNames); + $this->assertEquals($configCacheValues, $cachedStorage->readMultiple($configNames)); } /** @@ -87,7 +90,7 @@ public function testGetMultipleOnPartiallyPrimedCache() { $configNames = array( 'foo.bar', 'baz.back', - 'dididi.idiback', + $this->randomName() . '. ' . $this->randomName(), ); $configCacheValues = array( 'foo.bar' => (object) array( @@ -102,13 +105,14 @@ public function testGetMultipleOnPartiallyPrimedCache() { $cache->set($key, $value); } + $response = array($configNames[2] => array($this->randomName())); $storage = $this->getMock('Drupal\Core\Config\StorageInterface'); $storage->expects($this->once()) ->method('readMultiple') - ->with(array(2 => 'dididi.idiback')) - ->will($this->returnValue(array('dididi.idiback' => array('yo wtf')))); + ->with(array(2 => $configNames[2])) + ->will($this->returnValue($response)); $cachedStorage = new CachedStorage($storage, $cache); - $cachedStorage->readMultiple($configNames); + $this->assertEquals($configCacheValues + $response, $cachedStorage->readMultiple($configNames)); } }