
| Current Path : /var/www/html/ift/web/core/tests/Drupal/Tests/Core/Config/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/ift/web/core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php |
<?php
namespace Drupal\Tests\Core\Config;
use Drupal\Tests\UnitTestCase;
use Drupal\Core\Config\CachedStorage;
use Drupal\Core\Cache\NullBackend;
/**
* Tests the interaction of cache and file storage in CachedStorage.
*
* @group Config
*/
class CachedStorageTest extends UnitTestCase {
/**
* @var \Drupal\Core\Cache\CacheFactoryInterface|\PHPUnit\Framework\MockObject\MockObject
*/
protected $cacheFactory;
/**
* Test listAll static cache.
*/
public function testListAllStaticCache() {
$prefix = __FUNCTION__;
$storage = $this->createMock('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));
}
}