class TestStorage

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php \Drupal\Tests\Core\Config\TestStorage
  2. 10 core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php \Drupal\Tests\Core\Config\TestStorage
  3. 11.x core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php \Drupal\Tests\Core\Config\TestStorage

Provides a test implementation of \Drupal\Core\Config\StorageInterface.

Hierarchy

Expanded class hierarchy of TestStorage

File

core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php, line 173

Namespace

Drupal\Tests\Core\Config
View source
class TestStorage extends MemoryStorage {
    
    /**
     * Provides a setter to bypass the array typehint on ::write().
     *
     * This method allows us to create invalid configurations. The method
     * ::write() only allows values of the type array.
     */
    public function setValue($name, $value) {
        $this->config[$this->collection][$name] = $value;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
MemoryStorage::$collection protected property The storage collection.
MemoryStorage::$config protected property The configuration, an object shared by reference across collections.
MemoryStorage::createCollection public function Creates a collection on the storage. Overrides StorageInterface::createCollection
MemoryStorage::decode public function Decodes configuration data from the storage-specific format. Overrides StorageInterface::decode
MemoryStorage::delete public function Deletes a configuration object from the storage. Overrides StorageInterface::delete
MemoryStorage::deleteAll public function Deletes configuration objects whose names start with a given prefix. Overrides StorageInterface::deleteAll
MemoryStorage::encode public function Encodes configuration data into the storage-specific format. Overrides StorageInterface::encode
MemoryStorage::exists public function Returns whether a configuration object exists. Overrides StorageInterface::exists
MemoryStorage::getAllCollectionNames public function Gets the existing collections. Overrides StorageInterface::getAllCollectionNames
MemoryStorage::getCollectionName public function Gets the name of the current collection the storage is using. Overrides StorageInterface::getCollectionName
MemoryStorage::listAll public function Gets configuration object names starting with a given prefix. Overrides StorageInterface::listAll
MemoryStorage::read public function Reads configuration data from the storage. Overrides StorageInterface::read
MemoryStorage::readMultiple public function Reads configuration data from the storage. Overrides StorageInterface::readMultiple
MemoryStorage::rename public function Renames a configuration object in the storage. Overrides StorageInterface::rename
MemoryStorage::write public function Writes configuration data to the storage. Overrides StorageInterface::write
MemoryStorage::__construct public function Constructs a new MemoryStorage.
StorageInterface::DEFAULT_COLLECTION constant The default collection name.
TestStorage::setValue public function Provides a setter to bypass the array typehint on ::write().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.