public function FilteredStorageTest::testSettingStorages in Config Filter 8
Same name and namespace in other branches
- 8.2 src/Tests/FilteredStorageTest.php \Drupal\config_filter\Tests\FilteredStorageTest::testSettingStorages()
Test that the storage is set on the filters.
File
- src/
Tests/ FilteredStorageTest.php, line 35
Class
- FilteredStorageTest
- Tests StorageWrapper operations using the CachedStorage.
Namespace
Drupal\config_filter\TestsCode
public function testSettingStorages() {
/** @var \Drupal\config_filter\Tests\TransparentFilter[] $filters */
$filters = static::getProtectedFilters($this->storage);
foreach ($filters as $filter) {
// Test that the source storage is a ReadonlyStorage and wraps the cached
// storage from the inherited test.
$readonly = $filter
->getPrivateSourceStorage();
$this
->assertInstanceOf(ReadOnlyStorage::class, $readonly);
$readonlyReflection = new \ReflectionClass(ReadOnlyStorage::class);
$storageProperty = $readonlyReflection
->getProperty('storage');
$storageProperty
->setAccessible(TRUE);
$source = $storageProperty
->getValue($readonly);
$this
->assertInstanceOf(CachedStorage::class, $source);
// Assert that the filter gets the storage.
$this
->assertEquals($this->storage, $filter
->getPrivateFilteredStorage());
}
}