function ConfigImporterTest::testInstallBaseAndSubThemes
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInstallBaseAndSubThemes()
- 10 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInstallBaseAndSubThemes()
Tests installing a base themes and sub themes during configuration import.
See also
\Drupal\Core\EventSubscriber\ConfigImportSubscriber
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigImporterTest.php, line 696
Class
- ConfigImporterTest
- Tests importing configuration from files into active configuration.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testInstallBaseAndSubThemes() : void {
$sync = $this->container
->get('config.storage.sync');
$extensions = $sync->read('core.extension');
$extensions['theme']['test_base_theme'] = 0;
$extensions['theme']['test_subtheme'] = 0;
$extensions['theme']['test_subsubtheme'] = 0;
$sync->write('core.extension', $extensions);
$config_importer = $this->configImporter();
$config_importer->import();
$this->assertTrue($this->container
->get('theme_handler')
->themeExists('test_base_theme'));
$this->assertTrue($this->container
->get('theme_handler')
->themeExists('test_subsubtheme'));
$this->assertTrue($this->container
->get('theme_handler')
->themeExists('test_subtheme'));
// Test uninstalling them.
$extensions = $sync->read('core.extension');
unset($extensions['theme']['test_base_theme']);
unset($extensions['theme']['test_subsubtheme']);
unset($extensions['theme']['test_subtheme']);
$sync->write('core.extension', $extensions);
$config_importer = $this->configImporter();
$config_importer->import();
$this->assertFalse($this->container
->get('theme_handler')
->themeExists('test_base_theme'));
$this->assertFalse($this->container
->get('theme_handler')
->themeExists('test_subsubtheme'));
$this->assertFalse($this->container
->get('theme_handler')
->themeExists('test_subtheme'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.