You are here

class ManagedStorageTest in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php \Drupal\KernelTests\Core\Config\Storage\ManagedStorageTest
  2. 9 core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php \Drupal\KernelTests\Core\Config\Storage\ManagedStorageTest

Tests ManagedStorage operations.

@group config

Hierarchy

  • class \Drupal\KernelTests\Core\Config\Storage\ManagedStorageTest extends \Drupal\KernelTests\Core\Config\Storage\ConfigStorageTestBase implements \Drupal\Core\Config\StorageManagerInterface

Expanded class hierarchy of ManagedStorageTest

File

core/tests/Drupal/KernelTests/Core/Config/Storage/ManagedStorageTest.php, line 14

Namespace

Drupal\KernelTests\Core\Config\Storage
View source
class ManagedStorageTest extends ConfigStorageTestBase implements StorageManagerInterface {

  /**
   * {@inheritdoc}
   */
  public function getStorage() {

    // We return a new storage every time to make sure the managed storage
    // only calls this once and retains the configuration by itself.
    return new MemoryStorage();
  }

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->storage = new ManagedStorage($this);

    // ::listAll() verifications require other configuration data to exist.
    $this->storage
      ->write('system.performance', []);
  }

  /**
   * {@inheritdoc}
   */
  protected function read($name) {
    return $this->storage
      ->read($name);
  }

  /**
   * {@inheritdoc}
   */
  protected function insert($name, $data) {
    $this->storage
      ->write($name, $data);
  }

  /**
   * {@inheritdoc}
   */
  protected function update($name, $data) {
    $this->storage
      ->write($name, $data);
  }

  /**
   * {@inheritdoc}
   */
  protected function delete($name) {
    $this->storage
      ->delete($name);
  }

  /**
   * {@inheritdoc}
   */
  public function testInvalidStorage() {
    $this
      ->markTestSkipped('ManagedStorage cannot be invalid.');
  }

}

Members