StorageReplaceDataWrapperTest.php in Drupal 10
File
core/tests/Drupal/KernelTests/Core/Config/Storage/StorageReplaceDataWrapperTest.php
View source
<?php
namespace Drupal\KernelTests\Core\Config\Storage;
use Drupal\config\StorageReplaceDataWrapper;
use Drupal\Core\Config\StorageInterface;
class StorageReplaceDataWrapperTest extends ConfigStorageTestBase {
protected function setUp() : void {
parent::setUp();
$this->storage = new StorageReplaceDataWrapper($this->container
->get('config.storage'));
$this->storage
->write('system.performance', []);
$this->storage
->replaceData('system.performance', [
'foo' => 'bar',
]);
}
protected function read($name) {
return $this->storage
->read($name);
}
protected function insert($name, $data) {
$this->storage
->write($name, $data);
}
protected function update($name, $data) {
$this->storage
->write($name, $data);
}
protected function delete($name) {
$this->storage
->delete($name);
}
public function testInvalidStorage() {
$this
->markTestSkipped('No-op as this test does not make sense');
}
public function testCreateCollection($collection) {
$initial_collection_name = $this->storage
->getCollectionName();
$new_storage = $this->storage
->createCollection($collection);
$this
->assertSame($collection, $new_storage
->getCollectionName());
$this
->assertSame($initial_collection_name, $this->storage
->getCollectionName());
}
public function providerCollections() {
return [
[
StorageInterface::DEFAULT_COLLECTION,
],
[
'foo.bar',
],
];
}
}