You are here

public function ConfigProfileOverridesTest::testConfigOverrides in Configuration Update Manager 8

Tests that config overrides work as expected.

File

config_update_ui/tests/src/Functional/ConfigProfileOverridesTest.php, line 62

Class

ConfigProfileOverridesTest
Verify config reports, reverts, and diffs with profile overrides.

Namespace

Drupal\Tests\config_update_ui\Functional

Code

public function testConfigOverrides() {

  // The Standard install profile contains a system.theme.yml file that
  // sets up bartik/seven as the default/admin theme. The default config
  // from the System module has no admin theme and stark as the default
  // theme. So first, run the report on simple configuration and verify
  // that system.theme is not shown (it should not be missing, or added,
  // or overridden).
  $this
    ->drupalGet('admin/config/development/configuration/report/type/system.simple');
  $session = $this
    ->assertSession();
  $session
    ->responseNotContains('system.theme');

  // Go to the Appearance page and change the theme to whatever is currently
  // disabled. Return to the report and verify that system.theme is there,
  // since it is now overridden.
  $this
    ->drupalGet('admin/appearance');
  $this
    ->clickLink('Install and set as default');
  $this
    ->drupalGet('admin/config/development/configuration/report/type/system.simple');
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains('system.theme');

  // Look at the differences for system.theme and verify it's against
  // the standard profile version, not default version. The line for
  // default should show bartik as the source; if it's against the system
  // version, the word bartik would not be there.
  $this
    ->drupalGet('admin/config/development/configuration/report/diff/system.simple/system.theme');
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains('bartik');

  // Revert and verify that it reverted to the profile version, not the
  // system module version.
  $this
    ->drupalGet('admin/config/development/configuration/report/revert/system.simple/system.theme');
  $this
    ->drupalPostForm(NULL, [], 'Revert');
  $this
    ->drupalGet('admin/config/development/configuration/single/export/system.simple/system.theme');
  $session = $this
    ->assertSession();
  $session
    ->pageTextContains('admin: seven');
  $session
    ->pageTextContains('default: bartik');
}