Verified Commit b0dc0e49 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3325571 by Murz, andypost, smustgrave, catch, larowlan: MemoryStorage...

Issue #3325571 by Murz, andypost, smustgrave, catch, larowlan: MemoryStorage fails with "Argument #1 ($array) must be of type array" error on calling function readMultiple()

(cherry picked from commit be366aec)
parent aaf2d2d1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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] = [];
  }

  /**
+0 −2
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@ protected function setUp(): void {
    $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', []);
  }

  /**
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ public function testCRUD() {
    // 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 @@ public function testCRUD() {
    $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);
+0 −3
Original line number Diff line number Diff line
@@ -20,9 +20,6 @@ protected function setUp(): void {

    $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) {
+0 −2
Original line number Diff line number Diff line
@@ -28,8 +28,6 @@ public function getStorage() {
  protected function setUp(): void {
    parent::setUp();
    $this->storage = new ManagedStorage($this);
    // ::listAll() verifications require other configuration data to exist.
    $this->storage->write('system.performance', []);
  }

  /**
Loading