Issue #3325571 by Murz, andypost, smustgrave, catch, larowlan: MemoryStorage fails with "Argument #1 ($array) must be of type array" error on calling function readMultiple()
parent
7d9c51d738
commit
be366aec48
|
@ -31,6 +31,7 @@ class MemoryStorage implements StorageInterface {
|
|||
public function __construct($collection = StorageInterface::DEFAULT_COLLECTION) {
|
||||
$this->collection = $collection;
|
||||
$this->config = new \ArrayObject();
|
||||
$this->config[$collection] = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,8 +37,6 @@ class CachedStorageTest extends ConfigStorageTestBase {
|
|||
$this->fileStorage = new FileStorage($dir);
|
||||
$this->storage = new CachedStorage($this->fileStorage, \Drupal::service('cache.config'));
|
||||
$this->cache = \Drupal::service('cache_factory')->get('config');
|
||||
// ::listAll() verifications require other configuration data to exist.
|
||||
$this->storage->write('system.performance', []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,6 +39,9 @@ abstract class ConfigStorageTestBase extends KernelTestBase {
|
|||
// Checking whether a non-existing name exists returns FALSE.
|
||||
$this->assertFalse($this->storage->exists($name));
|
||||
|
||||
// Checking whether readMultiple() works with empty storage.
|
||||
$this->assertEmpty($this->storage->readMultiple([$name]));
|
||||
|
||||
// Reading a non-existing name returns FALSE.
|
||||
$data = $this->storage->read($name);
|
||||
$this->assertFalse($data);
|
||||
|
@ -59,6 +62,7 @@ abstract class ConfigStorageTestBase extends KernelTestBase {
|
|||
$this->assertTrue($result);
|
||||
|
||||
// Listing all names returns all.
|
||||
$this->storage->write('system.performance', []);
|
||||
$names = $this->storage->listAll();
|
||||
$this->assertContains('system.performance', $names);
|
||||
$this->assertContains($name, $names);
|
||||
|
|
|
@ -20,9 +20,6 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
|
|||
|
||||
$this->storage = new DatabaseStorage($this->container->get('database'), 'config');
|
||||
$this->invalidStorage = new DatabaseStorage($this->container->get('database'), 'invalid');
|
||||
|
||||
// ::listAll() verifications require other configuration data to exist.
|
||||
$this->storage->write('system.performance', []);
|
||||
}
|
||||
|
||||
protected function read($name) {
|
||||
|
|
|
@ -28,8 +28,6 @@ class ManagedStorageTest extends ConfigStorageTestBase implements StorageManager
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->storage = new ManagedStorage($this);
|
||||
// ::listAll() verifications require other configuration data to exist.
|
||||
$this->storage->write('system.performance', []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,8 +17,6 @@ class MemoryStorageTest extends ConfigStorageTestBase {
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->storage = new MemoryStorage();
|
||||
// ::listAll() verifications require other configuration data to exist.
|
||||
$this->storage->write('system.performance', []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,9 +18,6 @@ class StorageReplaceDataWrapperTest extends ConfigStorageTestBase {
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->storage = new StorageReplaceDataWrapper($this->container->get('config.storage'));
|
||||
// ::listAll() verifications require other configuration data to exist.
|
||||
$this->storage->write('system.performance', []);
|
||||
$this->storage->replaceData('system.performance', ['foo' => 'bar']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue