function RecipeConfigStorageWrapperTest::testReadFromB

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

Validate that we read from storage B second.

File

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

Class

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

Namespace

Drupal\Tests\Core\Recipe

Code

public function testReadFromB() : void {
    $a = $this->createMock(StorageInterface::class);
    $a->expects($this->once())
        ->method('read')
        ->with('a_key')
        ->willReturn(FALSE);
    $b = $this->createMock(StorageInterface::class);
    $value = [
        'a_value',
    ];
    $b->expects($this->once())
        ->method('read')
        ->with('a_key')
        ->willReturn($value);
    $storage = new RecipeConfigStorageWrapper($a, $b);
    $this->assertSame($value, $storage->read('a_key'));
}

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