function RecipeConfigStorageWrapperTest::generateStorages

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

Generate two storages where the second storage should return a value.

Parameters

bool $b_return: The return value for storage $b's exist method.

Return value

\Drupal\Core\Config\StorageInterface[] An array of two mocked storages.

2 calls to RecipeConfigStorageWrapperTest::generateStorages()
RecipeConfigStorageWrapperTest::testNotExists in core/tests/Drupal/Tests/Core/Recipe/RecipeConfigStorageWrapperTest.php
Validate FALSE when neither storage contains a key.
RecipeConfigStorageWrapperTest::testRightSideExists in core/tests/Drupal/Tests/Core/Recipe/RecipeConfigStorageWrapperTest.php
Validate that we fall back to the second storage.

File

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

Class

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

Namespace

Drupal\Tests\Core\Recipe

Code

private function generateStorages(bool $b_return) : array {
    $a = $this->createMock(StorageInterface::class);
    $a->expects($this->once())
        ->method('exists')
        ->with('a_key')
        ->willReturn(FALSE);
    $b = $this->createMock(StorageInterface::class);
    $b->expects($this->once())
        ->method('exists')
        ->with('a_key')
        ->willReturn($b_return);
    return [
        $a,
        $b,
    ];
}

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