You are here

public function FormTest::testStylesSettingsOnStyleRename in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FormTest.php \Drupal\Tests\styleswitcher\Functional\FormTest::testStylesSettingsOnStyleRename()

Tests the styles settings config changes when a style is renamed via form.

File

tests/src/Functional/FormTest.php, line 210

Class

FormTest
Tests Style Switcher forms.

Namespace

Drupal\Tests\styleswitcher\Functional

Code

public function testStylesSettingsOnStyleRename() {
  $this
    ->config('styleswitcher.custom_styles')
    ->set('styles', $this
    ->composeStyles([
    'A' => NULL,
  ]))
    ->save();
  $this
    ->config('styleswitcher.styles_settings')
    ->set('settings.theme_z', [
    'custom/a' => [],
  ])
    ->save();

  // Rename the style via form.
  $this
    ->drupalGet($this->adminPath . '/custom/a');
  $this
    ->submitForm([
    'name' => 'b',
  ], 'Save');
  $this
    ->assertArrayHasKey('custom/b', $this
    ->config('styleswitcher.styles_settings')
    ->get('settings.theme_z'));
  $this
    ->assertArrayNotHasKey('custom/a', $this
    ->config('styleswitcher.styles_settings')
    ->get('settings.theme_z'));
}