1. 8.2.x core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
  2. 8.2.x core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php
  3. 8.0.x core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
  4. 8.0.x core/modules/config/src/Tests/Storage/DatabaseStorageTest.php
  5. 8.1.x core/modules/system/src/Tests/KeyValueStore/DatabaseStorageTest.php
  6. 8.1.x core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
  7. 8.3.x core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
  8. 8.3.x core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageTest.php

Namespace

Drupal\KernelTests\Core\Config\Storage

File

core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
View source
  1. <?php
  2. namespace Drupal\KernelTests\Core\Config\Storage;
  3. use Drupal\Core\Config\DatabaseStorage;
  4. /**
  5. * Tests DatabaseStorage operations.
  6. *
  7. * @group config
  8. */
  9. class DatabaseStorageTest extends ConfigStorageTestBase {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. protected function setUp() {
  14. parent::setUp();
  15. $this->storage = new DatabaseStorage($this->container->get('database'), 'config');
  16. $this->invalidStorage = new DatabaseStorage($this->container->get('database'), 'invalid');
  17. // ::listAll() verifications require other configuration data to exist.
  18. $this->storage->write('system.performance', array());
  19. }
  20. protected function read($name) {
  21. $data = db_query('SELECT data FROM {config} WHERE name = :name', array(':name' => $name))->fetchField();
  22. return unserialize($data);
  23. }
  24. protected function insert($name, $data) {
  25. db_insert('config')->fields(array('name' => $name, 'data' => $data))->execute();
  26. }
  27. protected function update($name, $data) {
  28. db_update('config')->fields(array('data' => $data))->condition('name', $name)->execute();
  29. }
  30. protected function delete($name) {
  31. db_delete('config')->condition('name', $name)->execute();
  32. }
  33. }

Classes

Namesort descending Description
DatabaseStorageTest Tests DatabaseStorage operations.