You are here

public function ConfigTest::testThemesUninstalled in Style Switcher 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Kernel/ConfigTest.php \Drupal\Tests\styleswitcher\Kernel\ConfigTest::testThemesUninstalled()

Tests that corresponding configs are deleted when themes are uninstalled.

File

tests/src/Kernel/ConfigTest.php, line 30

Class

ConfigTest
Tests Style Switcher configs.

Namespace

Drupal\Tests\styleswitcher\Kernel

Code

public function testThemesUninstalled() {
  $theme_installer = \Drupal::service('theme_installer');

  // Install a theme and create some styles settings.
  $theme_installer
    ->install([
    'styleswitcher_test_theme',
  ]);
  $this
    ->config('styleswitcher.styles_settings')
    ->set('settings.styleswitcher_test_theme', [
    'style' => [],
  ])
    ->save();

  // Uninstall a theme.
  $theme_installer
    ->uninstall([
    'styleswitcher_test_theme',
  ]);
  $this
    ->assertArrayNotHasKey('styleswitcher_test_theme', $this
    ->config('styleswitcher.styles_settings')
    ->get('settings'));
}