getMock('Drupal\Core\Config\StorageInterface'); $response = ["$prefix." . $this->randomMachineName(), "$prefix." . $this->randomMachineName()]; $storage->expects($this->once()) ->method('listAll') ->with($prefix) ->will($this->returnValue($response)); $cache = new NullBackend(__FUNCTION__); $cachedStorage = new CachedStorage($storage, $cache); $this->assertEquals($response, $cachedStorage->listAll($prefix)); $this->assertEquals($response, $cachedStorage->listAll($prefix)); } }