function RecipeMultipleModulesConfigStorageTest::testExists

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

Tests exists() returns TRUE when config is in any directory.

File

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

Class

RecipeMultipleModulesConfigStorageTest
Tests RecipeMultipleModulesConfigStorage.

Namespace

Drupal\Tests\Core\Recipe

Code

public function testExists() : void {
  $storage = RecipeMultipleModulesConfigStorage::createFromModuleList([
    'system',
    'user',
  ], $this->extensionList);
  // Config in System module only but does not begin with 'system.'.
  $this->assertFalse($storage->exists('node.settings'));
  // Config in User module.
  $this->assertTrue($storage->exists('user.settings'));
  // Config in both directories.
  $this->assertTrue($storage->exists('system.site'));
  // Config that does not exist anywhere.
  $this->assertFalse($storage->exists('nonexistent.config'));
}

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