You are here

public function ConfigIgnoreTest::testValidateForceImportingWithWildcard in Config Ignore 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ConfigIgnoreTest.php \Drupal\Tests\config_ignore\Functional\ConfigIgnoreTest::testValidateForceImportingWithWildcard()

Verify excluded configuration works with wildcards.

This test cover the scenario where a wildcard matches a specific configuration, but that's still imported due exclusion.

File

tests/src/Functional/ConfigIgnoreTest.php, line 111

Class

ConfigIgnoreTest
Test functionality of config_ignore module.

Namespace

Drupal\Tests\config_ignore\Functional

Code

public function testValidateForceImportingWithWildcard() {

  // Set the site name to a known value that we later will try and overwrite.
  $this
    ->config('system.site')
    ->set('name', 'Test import')
    ->save();

  // Set the system.site:name to be (force-) imported upon config import.
  $settings = [
    'system.*',
    '~system.site',
  ];
  $this
    ->config('config_ignore.settings')
    ->set('ignored_config_entities', $settings)
    ->save();
  $this
    ->doExport();

  // Change the site name, perform an import and see if the site name remains
  // the same, as it should.
  $this
    ->config('system.site')
    ->set('name', 'Changed title')
    ->save();
  $this
    ->doImport();
  $this
    ->assertEquals('Test import', $this
    ->config('system.site')
    ->get('name'));
}