function RecipeConfigStorageWrapperTest::testReadMultiple

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Recipe/RecipeConfigStorageWrapperTest.php \Drupal\Tests\Core\Recipe\RecipeConfigStorageWrapperTest::testReadMultiple()

Test reading multiple values.

File

core/tests/Drupal/Tests/Core/Recipe/RecipeConfigStorageWrapperTest.php, line 149

Class

RecipeConfigStorageWrapperTest
@coversDefaultClass \Drupal\Core\Recipe\RecipeConfigStorageWrapper @group Recipe

Namespace

Drupal\Tests\Core\Recipe

Code

public function testReadMultiple() : void {
    $a = $this->createMock(StorageInterface::class);
    $a->expects($this->once())
        ->method('readMultiple')
        ->with([
        'a_key',
        'b_key',
    ])
        ->willReturn([
        'a_key' => [
            'a_value',
        ],
    ]);
    $b = $this->createMock(StorageInterface::class);
    $b->expects($this->once())
        ->method('readMultiple')
        ->with([
        'a_key',
        'b_key',
    ])
        ->willReturn([
        'b_key' => [
            'b_value',
        ],
    ]);
    $storage = new RecipeConfigStorageWrapper($a, $b);
    $this->assertEquals([
        'a_key' => [
            'a_value',
        ],
        'b_key' => [
            'b_value',
        ],
    ], $storage->readMultiple([
        'a_key',
        'b_key',
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.