function RecipeMultipleModulesConfigStorageTest::testRead

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Recipe/RecipeMultipleModulesConfigStorageTest.php \Drupal\Tests\Core\Recipe\RecipeMultipleModulesConfigStorageTest::testRead()

Tests read() returns from the first directory that has the config.

File

core/tests/Drupal/Tests/Core/Recipe/RecipeMultipleModulesConfigStorageTest.php, line 100

Class

RecipeMultipleModulesConfigStorageTest
Tests RecipeMultipleModulesConfigStorage.

Namespace

Drupal\Tests\Core\Recipe

Code

public function testRead() : void {
  $storage = RecipeMultipleModulesConfigStorage::createFromModuleList([
    'system',
    'user',
  ], $this->extensionList);
  // Config only in System module.
  $this->assertSame([
    'name' => 'Site A',
  ], $storage->read('system.site'));
  // Config only in User module.
  $this->assertSame([
    'register' => 'visitors',
  ], $storage->read('user.settings'));
  // Non-existent config returns FALSE.
  $this->assertFalse($storage->read('nonexistent.config'));
}

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