diff --git a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php b/core/modules/config/src/Tests/ConfigSingleImportExportTest.php index a5b8386..d7f9c7f 100644 --- a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php +++ b/core/modules/config/src/Tests/ConfigSingleImportExportTest.php @@ -20,7 +20,8 @@ class ConfigSingleImportExportTest extends WebTestBase { public static $modules = [ 'block', 'config', - 'config_test' + 'config_test', + 'language', ]; protected function setUp() { diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php new file mode 100644 index 0000000..389f505 --- /dev/null +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php @@ -0,0 +1,95 @@ +storage = new StorageReplaceDataWrapper($this->container->get('config.storage')); + // ::listAll() verifications require other configuration data to exist. + $this->storage->write('system.performance', array()); + $this->storage->replaceData('system.performance', array('foo' => 'bar')); + } + + /** + * {@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() { + // No-op as this test does not make sense. + } + + /** + * Tests if new collections created correctly. + * + * @param string $collection + * The collection name. + * + * @dataProvider providerCollections + */ + public function testCreateCollection($collection) { + $expected_collection = $this->storage->getCollectionName(); + + // Create new storage with given and check collection set correctly. + $new_storage = $this->storage->createCollection($collection); + $new_collection = $new_storage->getCollectionName(); + $this->assertSame($collection, $new_collection); + + // Check collection not changed in the current storage instance. + $actual_collection = $this->storage->getCollectionName(); + $this->assertSame($expected_collection, $actual_collection); + } + + /** + * Data provider for testing different collections. + * + * @return array + * Returns an array of collection names. + */ + public function providerCollections() { + return [ + [StorageInterface::DEFAULT_COLLECTION], + ['foo.bar'], + ]; + } + +}