Issue #2776031 by fgm, andypost, voleger, yogeshmpawar, Berdir, joachim: Properly deprecate ThemeHandlerInterface install() and uninstall() also replace usage
parent
1fd92fcdd2
commit
c12498bd9e
|
|
@ -1641,7 +1641,7 @@ function install_core_entity_type_definitions() {
|
||||||
function install_profile_themes(&$install_state) {
|
function install_profile_themes(&$install_state) {
|
||||||
// Install the themes specified by the installation profile.
|
// Install the themes specified by the installation profile.
|
||||||
$themes = $install_state['profile_info']['themes'];
|
$themes = $install_state['profile_info']['themes'];
|
||||||
\Drupal::service('theme_handler')->install($themes);
|
\Drupal::service('theme_installer')->install($themes);
|
||||||
|
|
||||||
// Ensure that the install profile's theme is used.
|
// Ensure that the install profile's theme is used.
|
||||||
// @see _drupal_maintenance_theme()
|
// @see _drupal_maintenance_theme()
|
||||||
|
|
|
||||||
|
|
@ -829,7 +829,7 @@ class ConfigImporter {
|
||||||
$this->configManager->getConfigFactory()->reset('system.theme');
|
$this->configManager->getConfigFactory()->reset('system.theme');
|
||||||
$this->processedSystemTheme = TRUE;
|
$this->processedSystemTheme = TRUE;
|
||||||
}
|
}
|
||||||
$this->themeHandler->$op([$name]);
|
\Drupal::service('theme_installer')->$op([$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setProcessedExtension($type, $op, $name);
|
$this->setProcessedExtension($type, $op, $name);
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ class ThemeHandler implements ThemeHandlerInterface {
|
||||||
public function install(array $theme_list, $install_dependencies = TRUE) {
|
public function install(array $theme_list, $install_dependencies = TRUE) {
|
||||||
// We keep the old install() method as BC layer but redirect directly to the
|
// We keep the old install() method as BC layer but redirect directly to the
|
||||||
// theme installer.
|
// theme installer.
|
||||||
|
@trigger_error('\Drupal\Core\Extension\ThemeHandlerInterface::install() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Extension\ThemeInstallerInterface::install() instead. See https://www.drupal.org/node/3017233', E_USER_DEPRECATED);
|
||||||
return \Drupal::service('theme_installer')->install($theme_list, $install_dependencies);
|
return \Drupal::service('theme_installer')->install($theme_list, $install_dependencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,6 +92,7 @@ class ThemeHandler implements ThemeHandlerInterface {
|
||||||
public function uninstall(array $theme_list) {
|
public function uninstall(array $theme_list) {
|
||||||
// We keep the old uninstall() method as BC layer but redirect directly to
|
// We keep the old uninstall() method as BC layer but redirect directly to
|
||||||
// the theme installer.
|
// the theme installer.
|
||||||
|
@trigger_error('\Drupal\Core\Extension\ThemeHandlerInterface::uninstall() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Extension\ThemeInstallerInterface::uninstall() instead. See https://www.drupal.org/node/3017233', E_USER_DEPRECATED);
|
||||||
\Drupal::service('theme_installer')->uninstall($theme_list);
|
\Drupal::service('theme_installer')->uninstall($theme_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,11 @@ interface ThemeHandlerInterface {
|
||||||
* @throws \Drupal\Core\Extension\ExtensionNameLengthException
|
* @throws \Drupal\Core\Extension\ExtensionNameLengthException
|
||||||
* Thrown when the theme name is to long.
|
* Thrown when the theme name is to long.
|
||||||
*
|
*
|
||||||
* @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0.
|
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||||
* Use the theme_installer service instead.
|
* Use the theme_installer service instead.
|
||||||
*
|
*
|
||||||
* @see \Drupal\Core\Extension\ThemeInstallerInterface::install
|
* @see https://www.drupal.org/node/3017233
|
||||||
|
* @see \Drupal\Core\Extension\ThemeInstallerInterface::install()
|
||||||
*/
|
*/
|
||||||
public function install(array $theme_list, $install_dependencies = TRUE);
|
public function install(array $theme_list, $install_dependencies = TRUE);
|
||||||
|
|
||||||
|
|
@ -42,12 +43,12 @@ interface ThemeHandlerInterface {
|
||||||
* @throws \Drupal\Core\Extension\Exception\UninstalledExtensionException
|
* @throws \Drupal\Core\Extension\Exception\UninstalledExtensionException
|
||||||
* Thrown when you try to uninstall a theme that wasn't installed.
|
* Thrown when you try to uninstall a theme that wasn't installed.
|
||||||
*
|
*
|
||||||
* @see hook_themes_uninstalled()
|
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||||
*
|
|
||||||
* @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0.
|
|
||||||
* Use the theme_installer service instead.
|
* Use the theme_installer service instead.
|
||||||
*
|
*
|
||||||
* @see \Drupal\Core\Extension\ThemeInstallerInterface::uninstall
|
* @see https://www.drupal.org/node/3017233
|
||||||
|
* @see hook_themes_uninstalled()
|
||||||
|
* @see \Drupal\Core\Extension\ThemeInstallerInterface::uninstall()
|
||||||
*/
|
*/
|
||||||
public function uninstall(array $theme_list);
|
public function uninstall(array $theme_list);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ function hook_theme_suggestions_HOOK_alter(array &$suggestions, array $variables
|
||||||
* @param array $theme_list
|
* @param array $theme_list
|
||||||
* Array containing the names of the themes being installed.
|
* Array containing the names of the themes being installed.
|
||||||
*
|
*
|
||||||
* @see \Drupal\Core\Extension\ThemeHandler::install()
|
* @see \Drupal\Core\Extension\ThemeInstallerInterface::install()
|
||||||
*/
|
*/
|
||||||
function hook_themes_installed($theme_list) {
|
function hook_themes_installed($theme_list) {
|
||||||
foreach ($theme_list as $theme) {
|
foreach ($theme_list as $theme) {
|
||||||
|
|
@ -739,7 +739,7 @@ function hook_themes_installed($theme_list) {
|
||||||
* @param array $themes
|
* @param array $themes
|
||||||
* Array containing the names of the themes being uninstalled.
|
* Array containing the names of the themes being uninstalled.
|
||||||
*
|
*
|
||||||
* @see \Drupal\Core\Extension\ThemeHandler::uninstall()
|
* @see \Drupal\Core\Extension\ThemeInstallerInterface::uninstall()
|
||||||
*/
|
*/
|
||||||
function hook_themes_uninstalled(array $themes) {
|
function hook_themes_uninstalled(array $themes) {
|
||||||
// Remove some state entries depending on the theme.
|
// Remove some state entries depending on the theme.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class BlockAdminThemeTest extends BrowserTestBase {
|
||||||
$this->assertResponse(403);
|
$this->assertResponse(403);
|
||||||
|
|
||||||
// Install admin theme and confirm that tab is accessible.
|
// Install admin theme and confirm that tab is accessible.
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
$edit['admin_theme'] = 'bartik';
|
$edit['admin_theme'] = 'bartik';
|
||||||
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
||||||
$this->drupalGet('admin/structure/block/list/bartik');
|
$this->drupalGet('admin/structure/block/list/bartik');
|
||||||
|
|
@ -53,7 +53,7 @@ class BlockAdminThemeTest extends BrowserTestBase {
|
||||||
$this->drupalLogin($admin_user);
|
$this->drupalLogin($admin_user);
|
||||||
|
|
||||||
// Install admin theme and confirm that tab is accessible.
|
// Install admin theme and confirm that tab is accessible.
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
\Drupal::service('theme_installer')->install(['seven']);
|
||||||
$edit['admin_theme'] = 'seven';
|
$edit['admin_theme'] = 'seven';
|
||||||
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class BlockDemoTest extends BrowserTestBase {
|
||||||
|
|
||||||
foreach ($themes as $theme) {
|
foreach ($themes as $theme) {
|
||||||
// Install theme.
|
// Install theme.
|
||||||
$this->container->get('theme_handler')->install([$theme]);
|
$this->container->get('theme_installer')->install([$theme]);
|
||||||
// Confirm access to the block demo page for the theme.
|
// Confirm access to the block demo page for the theme.
|
||||||
$this->drupalGet('admin/structure/block/demo/' . $theme);
|
$this->drupalGet('admin/structure/block/demo/' . $theme);
|
||||||
$this->assertResponse(200);
|
$this->assertResponse(200);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class BlockHiddenRegionTest extends BrowserTestBase {
|
||||||
$theme = 'block_test_theme';
|
$theme = 'block_test_theme';
|
||||||
// We need to install a non-hidden theme so that there is more than one
|
// We need to install a non-hidden theme so that there is more than one
|
||||||
// local task.
|
// local task.
|
||||||
\Drupal::service('theme_handler')->install([$theme, 'stark']);
|
\Drupal::service('theme_installer')->install([$theme, 'stark']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', $theme)
|
->set('default', $theme)
|
||||||
->save();
|
->save();
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ class BlockTest extends BlockTestBase {
|
||||||
*/
|
*/
|
||||||
public function testBlockThemeSelector() {
|
public function testBlockThemeSelector() {
|
||||||
// Install all themes.
|
// Install all themes.
|
||||||
\Drupal::service('theme_handler')->install(['bartik', 'seven', 'stark']);
|
\Drupal::service('theme_installer')->install(['bartik', 'seven', 'stark']);
|
||||||
$theme_settings = $this->config('system.theme');
|
$theme_settings = $this->config('system.theme');
|
||||||
foreach (['bartik', 'seven', 'stark'] as $theme) {
|
foreach (['bartik', 'seven', 'stark'] as $theme) {
|
||||||
$this->drupalGet('admin/structure/block/list/' . $theme);
|
$this->drupalGet('admin/structure/block/list/' . $theme);
|
||||||
|
|
@ -275,7 +275,7 @@ class BlockTest extends BlockTestBase {
|
||||||
$this->drupalPlaceBlock('local_tasks_block');
|
$this->drupalPlaceBlock('local_tasks_block');
|
||||||
// Explicitly set the default and admin themes.
|
// Explicitly set the default and admin themes.
|
||||||
$theme = 'block_test_specialchars_theme';
|
$theme = 'block_test_specialchars_theme';
|
||||||
\Drupal::service('theme_handler')->install([$theme]);
|
\Drupal::service('theme_installer')->install([$theme]);
|
||||||
\Drupal::service('router.builder')->rebuild();
|
\Drupal::service('router.builder')->rebuild();
|
||||||
$this->drupalGet('admin/structure/block');
|
$this->drupalGet('admin/structure/block');
|
||||||
$this->assertEscaped('<"Cat" & \'Mouse\'>');
|
$this->assertEscaped('<"Cat" & \'Mouse\'>');
|
||||||
|
|
@ -484,17 +484,17 @@ class BlockTest extends BlockTestBase {
|
||||||
* Tests that uninstalling a theme removes its block configuration.
|
* Tests that uninstalling a theme removes its block configuration.
|
||||||
*/
|
*/
|
||||||
public function testUninstallTheme() {
|
public function testUninstallTheme() {
|
||||||
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_installer = \Drupal::service('theme_installer');
|
||||||
|
|
||||||
$theme_handler->install(['seven']);
|
$theme_installer->install(['seven']);
|
||||||
$this->config('system.theme')->set('default', 'seven')->save();
|
$this->config('system.theme')->set('default', 'seven')->save();
|
||||||
$block = $this->drupalPlaceBlock('system_powered_by_block', ['theme' => 'seven', 'region' => 'help']);
|
$block = $this->drupalPlaceBlock('system_powered_by_block', ['theme' => 'seven', 'region' => 'help']);
|
||||||
$this->drupalGet('<front>');
|
$this->drupalGet('<front>');
|
||||||
$this->assertText('Powered by Drupal');
|
$this->assertText('Powered by Drupal');
|
||||||
|
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
$theme_handler->uninstall(['seven']);
|
$theme_installer->uninstall(['seven']);
|
||||||
|
|
||||||
// Ensure that the block configuration does not exist anymore.
|
// Ensure that the block configuration does not exist anymore.
|
||||||
$this->assertIdentical(NULL, Block::load($block->id()));
|
$this->assertIdentical(NULL, Block::load($block->id()));
|
||||||
|
|
|
||||||
|
|
@ -84,11 +84,11 @@ class BlockUiTest extends BrowserTestBase {
|
||||||
$elements = $this->xpath('//div[contains(@class, "region-highlighted")]/div[contains(@class, "block-region") and contains(text(), :title)]', [':title' => 'Highlighted']);
|
$elements = $this->xpath('//div[contains(@class, "region-highlighted")]/div[contains(@class, "block-region") and contains(text(), :title)]', [':title' => 'Highlighted']);
|
||||||
$this->assertTrue(!empty($elements), 'Block demo regions are shown.');
|
$this->assertTrue(!empty($elements), 'Block demo regions are shown.');
|
||||||
|
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->drupalGet('admin/structure/block/demo/test_theme');
|
$this->drupalGet('admin/structure/block/demo/test_theme');
|
||||||
$this->assertEscaped('<strong>Test theme</strong>');
|
$this->assertEscaped('<strong>Test theme</strong>');
|
||||||
|
|
||||||
\Drupal::service('theme_handler')->install(['stable']);
|
\Drupal::service('theme_installer')->install(['stable']);
|
||||||
$this->drupalGet('admin/structure/block/demo/stable');
|
$this->drupalGet('admin/structure/block/demo/stable');
|
||||||
$this->assertResponse(404, 'Hidden themes that are not the default theme are not supported by the block demo screen');
|
$this->assertResponse(404, 'Hidden themes that are not the default theme are not supported by the block demo screen');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class NonDefaultBlockAdminTest extends BrowserTestBase {
|
||||||
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
|
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
|
||||||
$this->drupalLogin($admin_user);
|
$this->drupalLogin($admin_user);
|
||||||
$new_theme = 'bartik';
|
$new_theme = 'bartik';
|
||||||
\Drupal::service('theme_handler')->install([$new_theme]);
|
\Drupal::service('theme_installer')->install([$new_theme]);
|
||||||
$this->drupalGet('admin/structure/block/list/' . $new_theme);
|
$this->drupalGet('admin/structure/block/list/' . $new_theme);
|
||||||
$this->assertText('Bartik(' . t('active tab') . ')', 'Tab for non-default theme found.');
|
$this->assertText('Bartik(' . t('active tab') . ')', 'Tab for non-default theme found.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ class BlockStorageUnitTest extends KernelTestBase {
|
||||||
* Tests the installation of default blocks.
|
* Tests the installation of default blocks.
|
||||||
*/
|
*/
|
||||||
public function testDefaultBlocks() {
|
public function testDefaultBlocks() {
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$entities = $this->controller->loadMultiple();
|
$entities = $this->controller->loadMultiple();
|
||||||
$this->assertTrue(empty($entities), 'There are no blocks initially.');
|
$this->assertTrue(empty($entities), 'There are no blocks initially.');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
|
||||||
* Check the enabled Bartik blocks are correctly copied over.
|
* Check the enabled Bartik blocks are correctly copied over.
|
||||||
*/
|
*/
|
||||||
public function testNewDefaultThemeBlocks() {
|
public function testNewDefaultThemeBlocks() {
|
||||||
$theme_handler = $this->container->get('theme_handler');
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
|
$theme_installer = $this->container->get('theme_installer');
|
||||||
$default_theme = $this->config('system.theme')->get('default');
|
$default_theme = $this->config('system.theme')->get('default');
|
||||||
|
|
||||||
// Add two instances of the user login block.
|
// Add two instances of the user login block.
|
||||||
|
|
@ -47,7 +48,7 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
|
||||||
// The new theme is different from the previous default theme.
|
// The new theme is different from the previous default theme.
|
||||||
$this->assertNotEquals($new_theme, $default_theme);
|
$this->assertNotEquals($new_theme, $default_theme);
|
||||||
|
|
||||||
$theme_handler->install([$new_theme]);
|
$theme_installer->install([$new_theme]);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', $new_theme)
|
->set('default', $new_theme)
|
||||||
->save();
|
->save();
|
||||||
|
|
@ -74,7 +75,7 @@ class NewDefaultThemeBlocksTest extends KernelTestBase {
|
||||||
|
|
||||||
// Install a hidden base theme and ensure blocks are not copied.
|
// Install a hidden base theme and ensure blocks are not copied.
|
||||||
$base_theme = 'test_basetheme';
|
$base_theme = 'test_basetheme';
|
||||||
$theme_handler->install([$base_theme]);
|
$theme_installer->install([$base_theme]);
|
||||||
$new_blocks = $block_storage->getQuery()
|
$new_blocks = $block_storage->getQuery()
|
||||||
->condition('theme', $base_theme)
|
->condition('theme', $base_theme)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
||||||
->getStorage('block_content');
|
->getStorage('block_content');
|
||||||
|
|
||||||
// Install all themes.
|
// Install all themes.
|
||||||
\Drupal::service('theme_handler')->install(['bartik', 'seven', 'stark']);
|
\Drupal::service('theme_installer')->install(['bartik', 'seven', 'stark']);
|
||||||
$theme_settings = $this->config('system.theme');
|
$theme_settings = $this->config('system.theme');
|
||||||
foreach (['bartik', 'seven', 'stark'] as $default_theme) {
|
foreach (['bartik', 'seven', 'stark'] as $default_theme) {
|
||||||
// Change the default theme.
|
// Change the default theme.
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class BreakpointDiscoveryTest extends KernelTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['breakpoint_theme_test']);
|
\Drupal::service('theme_installer')->install(['breakpoint_theme_test']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -204,9 +204,10 @@ class CKEditorLoadingTest extends BrowserTestBase {
|
||||||
* Tests loading of theme's CKEditor stylesheets defined in the .info file.
|
* Tests loading of theme's CKEditor stylesheets defined in the .info file.
|
||||||
*/
|
*/
|
||||||
public function testExternalStylesheets() {
|
public function testExternalStylesheets() {
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
|
$theme_installer = \Drupal::service('theme_installer');
|
||||||
// Case 1: Install theme which has an absolute external CSS URL.
|
// Case 1: Install theme which has an absolute external CSS URL.
|
||||||
$theme_handler->install(['test_ckeditor_stylesheets_external']);
|
$theme_installer->install(['test_ckeditor_stylesheets_external']);
|
||||||
$this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_external')->save();
|
$this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_external')->save();
|
||||||
$expected = [
|
$expected = [
|
||||||
'https://fonts.googleapis.com/css?family=Open+Sans',
|
'https://fonts.googleapis.com/css?family=Open+Sans',
|
||||||
|
|
@ -214,7 +215,7 @@ class CKEditorLoadingTest extends BrowserTestBase {
|
||||||
$this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_external'));
|
$this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_external'));
|
||||||
|
|
||||||
// Case 2: Install theme which has an external protocol-relative CSS URL.
|
// Case 2: Install theme which has an external protocol-relative CSS URL.
|
||||||
$theme_handler->install(['test_ckeditor_stylesheets_protocol_relative']);
|
$theme_installer->install(['test_ckeditor_stylesheets_protocol_relative']);
|
||||||
$this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_protocol_relative')->save();
|
$this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_protocol_relative')->save();
|
||||||
$expected = [
|
$expected = [
|
||||||
'//fonts.googleapis.com/css?family=Open+Sans',
|
'//fonts.googleapis.com/css?family=Open+Sans',
|
||||||
|
|
@ -222,7 +223,7 @@ class CKEditorLoadingTest extends BrowserTestBase {
|
||||||
$this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_protocol_relative'));
|
$this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_protocol_relative'));
|
||||||
|
|
||||||
// Case 3: Install theme which has a relative CSS URL.
|
// Case 3: Install theme which has a relative CSS URL.
|
||||||
$theme_handler->install(['test_ckeditor_stylesheets_relative']);
|
$theme_installer->install(['test_ckeditor_stylesheets_relative']);
|
||||||
$this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_relative')->save();
|
$this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_relative')->save();
|
||||||
$expected = [
|
$expected = [
|
||||||
'core/modules/system/tests/themes/test_ckeditor_stylesheets_relative/css/yokotsoko.css',
|
'core/modules/system/tests/themes/test_ckeditor_stylesheets_relative/css/yokotsoko.css',
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ class CKEditorTest extends KernelTestBase {
|
||||||
$this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a CKEditorPluginInterface implementation exists.');
|
$this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a CKEditorPluginInterface implementation exists.');
|
||||||
|
|
||||||
// Enable the Bartik theme, which specifies a CKEditor stylesheet.
|
// Enable the Bartik theme, which specifies a CKEditor stylesheet.
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
$this->config('system.theme')->set('default', 'bartik')->save();
|
$this->config('system.theme')->set('default', 'bartik')->save();
|
||||||
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/base/elements.css'));
|
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/base/elements.css'));
|
||||||
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/captions.css'));
|
$expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/captions.css'));
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class ColorConfigSchemaTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
|
|
||||||
// Create user.
|
// Create user.
|
||||||
$this->adminUser = $this->drupalCreateUser(['administer themes']);
|
$this->adminUser = $this->drupalCreateUser(['administer themes']);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class ColorSafePreviewTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testColorPreview() {
|
public function testColorPreview() {
|
||||||
// Install the color test theme.
|
// Install the color test theme.
|
||||||
\Drupal::service('theme_handler')->install(['color_test_theme']);
|
\Drupal::service('theme_installer')->install(['color_test_theme']);
|
||||||
$this->drupalLogin($this->bigUser);
|
$this->drupalLogin($this->bigUser);
|
||||||
|
|
||||||
// Markup is being printed from a HTML file located in:
|
// Markup is being printed from a HTML file located in:
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class ColorTest extends BrowserTestBase {
|
||||||
'scheme_color' => '#3b3b3b',
|
'scheme_color' => '#3b3b3b',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
\Drupal::service('theme_handler')->install(array_keys($this->themes));
|
\Drupal::service('theme_installer')->install(array_keys($this->themes));
|
||||||
|
|
||||||
// Array filled with valid and not valid color values.
|
// Array filled with valid and not valid color values.
|
||||||
$this->colorTests = [
|
$this->colorTests = [
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class CommentLinksTest extends CommentTestBase {
|
||||||
*/
|
*/
|
||||||
public function testCommentLinks() {
|
public function testCommentLinks() {
|
||||||
// Bartik theme alters comment links, so use a different theme.
|
// Bartik theme alters comment links, so use a different theme.
|
||||||
\Drupal::service('theme_handler')->install(['stark']);
|
\Drupal::service('theme_installer')->install(['stark']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'stark')
|
->set('default', 'stark')
|
||||||
->save();
|
->save();
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testExtensionValidation() {
|
public function testExtensionValidation() {
|
||||||
\Drupal::service('module_installer')->install(['node']);
|
\Drupal::service('module_installer')->install(['node']);
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
$this->rebuildContainer();
|
$this->rebuildContainer();
|
||||||
|
|
||||||
$sync = $this->container->get('config.storage.sync');
|
$sync = $this->container->get('config.storage.sync');
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class ConfigInstallWebTest extends BrowserTestBase {
|
||||||
|
|
||||||
// Test installing a theme through the API that has existing configuration.
|
// Test installing a theme through the API that has existing configuration.
|
||||||
try {
|
try {
|
||||||
\Drupal::service('theme_handler')->install(['config_clash_test_theme']);
|
\Drupal::service('theme_installer')->install(['config_clash_test_theme']);
|
||||||
$this->fail('Expected PreExistingConfigException not thrown.');
|
$this->fail('Expected PreExistingConfigException not thrown.');
|
||||||
}
|
}
|
||||||
catch (PreExistingConfigException $e) {
|
catch (PreExistingConfigException $e) {
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class DisplayApiTest extends FieldKernelTestBase {
|
||||||
public function testFieldItemListView() {
|
public function testFieldItemListView() {
|
||||||
$items = $this->entity->get($this->fieldName);
|
$items = $this->entity->get($this->fieldName);
|
||||||
|
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
|
|
||||||
// No display settings: check that default display settings are used.
|
// No display settings: check that default display settings are used.
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Use Classy theme for testing markup output.
|
// Use Classy theme for testing markup output.
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
$this->installEntitySchema('entity_test');
|
$this->installEntitySchema('entity_test');
|
||||||
// Grant the 'view test entity' permission.
|
// Grant the 'view test entity' permission.
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class MultipleFileUploadTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testMultipleFileFieldWithAllFileExtensions() {
|
public function testMultipleFileFieldWithAllFileExtensions() {
|
||||||
$theme = 'test_theme_settings';
|
$theme = 'test_theme_settings';
|
||||||
\Drupal::service('theme_handler')->install([$theme]);
|
\Drupal::service('theme_installer')->install([$theme]);
|
||||||
$this->drupalGet("admin/appearance/settings/$theme");
|
$this->drupalGet("admin/appearance/settings/$theme");
|
||||||
|
|
||||||
$edit = [];
|
$edit = [];
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class HelpTopicTest extends BrowserTestBase {
|
||||||
|
|
||||||
// These tests rely on some markup from the 'Seven' theme and we test theme
|
// These tests rely on some markup from the 'Seven' theme and we test theme
|
||||||
// provided help topics.
|
// provided help topics.
|
||||||
\Drupal::service('theme_handler')->install(['seven', 'help_topics_test_theme']);
|
\Drupal::service('theme_installer')->install(['seven', 'help_topics_test_theme']);
|
||||||
\Drupal::service('config.factory')->getEditable('system.theme')->set('admin', 'seven')->save();
|
\Drupal::service('config.factory')->getEditable('system.theme')->set('admin', 'seven')->save();
|
||||||
|
|
||||||
// Place various blocks.
|
// Place various blocks.
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class HelpTopicTranslationTest extends BrowserTestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// These tests rely on some markup from the 'Seven' theme.
|
// These tests rely on some markup from the 'Seven' theme.
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
\Drupal::service('theme_installer')->install(['seven']);
|
||||||
\Drupal::service('config.factory')->getEditable('system.theme')->set('admin', 'seven')->save();
|
\Drupal::service('config.factory')->getEditable('system.theme')->set('admin', 'seven')->save();
|
||||||
|
|
||||||
// Place various blocks.
|
// Place various blocks.
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class HistoryTimestampTest extends ViewsKernelTestBase {
|
||||||
$this->installSchema('history', ['history']);
|
$this->installSchema('history', ['history']);
|
||||||
// Use classy theme because its marker is wrapped in a span so it can be
|
// Use classy theme because its marker is wrapped in a span so it can be
|
||||||
// easily targeted with xpath.
|
// easily targeted with xpath.
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('classy'));
|
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('classy'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ abstract class LayoutBuilderCompatibilityTestBase extends EntityKernelTestBase {
|
||||||
// Set up a non-admin user that is allowed to view test entities.
|
// Set up a non-admin user that is allowed to view test entities.
|
||||||
\Drupal::currentUser()->setAccount($this->createUser(['uid' => 2], ['view test entity']));
|
\Drupal::currentUser()->setAccount($this->createUser(['uid' => 2], ['view test entity']));
|
||||||
|
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
|
|
||||||
$field_storage = FieldStorageConfig::create([
|
$field_storage = FieldStorageConfig::create([
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class MediaSourceOEmbedVideoTest extends MediaSourceTestBase {
|
||||||
$this->assertNoRaw('core/modules/media/templates/media-oembed-iframe.html.twig');
|
$this->assertNoRaw('core/modules/media/templates/media-oembed-iframe.html.twig');
|
||||||
|
|
||||||
// Test themes not inheriting from stable.
|
// Test themes not inheriting from stable.
|
||||||
\Drupal::service('theme_handler')->install(['stark']);
|
\Drupal::service('theme_installer')->install(['stark']);
|
||||||
$this->config('system.theme')->set('default', 'stark')->save();
|
$this->config('system.theme')->set('default', 'stark')->save();
|
||||||
$this->drupalGet('media/oembed', ['query' => $query]);
|
$this->drupalGet('media/oembed', ['query' => $query]);
|
||||||
$assert_session->pageTextContains('By the power of Greyskull, Vimeo works!');
|
$assert_session->pageTextContains('By the power of Greyskull, Vimeo works!');
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class MenuLinkContentTranslationUITest extends ContentTranslationUITestBase {
|
||||||
$entityId = $this->createEntity([], 'en');
|
$entityId = $this->createEntity([], 'en');
|
||||||
|
|
||||||
// Set up Seven as the admin theme to test.
|
// Set up Seven as the admin theme to test.
|
||||||
$this->container->get('theme_handler')->install(['seven']);
|
$this->container->get('theme_installer')->install(['seven']);
|
||||||
$edit = [];
|
$edit = [];
|
||||||
$edit['admin_theme'] = 'seven';
|
$edit['admin_theme'] = 'seven';
|
||||||
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
|
||||||
$article = $this->drupalCreateNode(['type' => 'article', 'langcode' => $this->langcodes[0]]);
|
$article = $this->drupalCreateNode(['type' => 'article', 'langcode' => $this->langcodes[0]]);
|
||||||
|
|
||||||
// Set up Seven as the admin theme and use it for node editing.
|
// Set up Seven as the admin theme and use it for node editing.
|
||||||
$this->container->get('theme_handler')->install(['seven']);
|
$this->container->get('theme_installer')->install(['seven']);
|
||||||
$edit = [];
|
$edit = [];
|
||||||
$edit['admin_theme'] = 'seven';
|
$edit['admin_theme'] = 'seven';
|
||||||
$edit['use_admin_theme'] = TRUE;
|
$edit['use_admin_theme'] = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ class StandardProfileTest extends BrowserTestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Use Classy theme for testing markup output.
|
// Use Classy theme for testing markup output.
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
|
|
||||||
$this->baseUri = Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString();
|
$this->baseUri = Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class NumberFieldRdfaTest extends FieldRdfaTestBase {
|
||||||
* Tests the integer formatter with settings.
|
* Tests the integer formatter with settings.
|
||||||
*/
|
*/
|
||||||
public function testIntegerFormatterWithSettings() {
|
public function testIntegerFormatterWithSettings() {
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
$this->fieldType = 'integer';
|
$this->fieldType = 'integer';
|
||||||
$formatter = [
|
$formatter = [
|
||||||
|
|
@ -73,7 +73,7 @@ class NumberFieldRdfaTest extends FieldRdfaTestBase {
|
||||||
* Tests the float formatter with settings.
|
* Tests the float formatter with settings.
|
||||||
*/
|
*/
|
||||||
public function testFloatFormatterWithSettings() {
|
public function testFloatFormatterWithSettings() {
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
$this->fieldType = 'float';
|
$this->fieldType = 'float';
|
||||||
$formatter = [
|
$formatter = [
|
||||||
|
|
@ -123,7 +123,7 @@ class NumberFieldRdfaTest extends FieldRdfaTestBase {
|
||||||
* Tests the float formatter with a scale. Scale is exercised.
|
* Tests the float formatter with a scale. Scale is exercised.
|
||||||
*/
|
*/
|
||||||
public function testFloatFormatterWithScaleExercised() {
|
public function testFloatFormatterWithScaleExercised() {
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
$this->fieldType = 'float';
|
$this->fieldType = 'float';
|
||||||
$formatter = [
|
$formatter = [
|
||||||
|
|
@ -161,7 +161,7 @@ class NumberFieldRdfaTest extends FieldRdfaTestBase {
|
||||||
* Tests the decimal formatter with settings.
|
* Tests the decimal formatter with settings.
|
||||||
*/
|
*/
|
||||||
public function testDecimalFormatterWithSettings() {
|
public function testDecimalFormatterWithSettings() {
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
$this->fieldType = 'decimal';
|
$this->fieldType = 'decimal';
|
||||||
$formatter = [
|
$formatter = [
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ class ShortcutLinksTest extends ShortcutTestBase {
|
||||||
* Tests that the "add to shortcut" and "remove from shortcut" links work.
|
* Tests that the "add to shortcut" and "remove from shortcut" links work.
|
||||||
*/
|
*/
|
||||||
public function testShortcutQuickLink() {
|
public function testShortcutQuickLink() {
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
\Drupal::service('theme_installer')->install(['seven']);
|
||||||
$this->config('system.theme')->set('admin', 'seven')->save();
|
$this->config('system.theme')->set('admin', 'seven')->save();
|
||||||
$this->config('node.settings')->set('use_admin_theme', '1')->save();
|
$this->config('node.settings')->set('use_admin_theme', '1')->save();
|
||||||
$this->container->get('router.builder')->rebuild();
|
$this->container->get('router.builder')->rebuild();
|
||||||
|
|
@ -305,7 +305,7 @@ class ShortcutLinksTest extends ShortcutTestBase {
|
||||||
*/
|
*/
|
||||||
public function testNoShortcutLink() {
|
public function testNoShortcutLink() {
|
||||||
// Change to a theme that displays shortcuts.
|
// Change to a theme that displays shortcuts.
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
\Drupal::service('theme_installer')->install(['seven']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'seven')
|
->set('default', 'seven')
|
||||||
->save();
|
->save();
|
||||||
|
|
@ -336,7 +336,7 @@ class ShortcutLinksTest extends ShortcutTestBase {
|
||||||
*/
|
*/
|
||||||
public function testAccessShortcutsPermission() {
|
public function testAccessShortcutsPermission() {
|
||||||
// Change to a theme that displays shortcuts.
|
// Change to a theme that displays shortcuts.
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
\Drupal::service('theme_installer')->install(['seven']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'seven')
|
->set('default', 'seven')
|
||||||
->save();
|
->save();
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class StatisticsAttachedTest extends BrowserTestBase {
|
||||||
|
|
||||||
// Install "statistics_test_attached" and set it as the default theme.
|
// Install "statistics_test_attached" and set it as the default theme.
|
||||||
$theme = 'statistics_test_attached';
|
$theme = 'statistics_test_attached';
|
||||||
\Drupal::service('theme_handler')->install([$theme]);
|
\Drupal::service('theme_installer')->install([$theme]);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', $theme)
|
->set('default', $theme)
|
||||||
->save();
|
->save();
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use Drupal\Core\Config\PreExistingConfigException;
|
||||||
use Drupal\Core\Config\UnmetDependenciesException;
|
use Drupal\Core\Config\UnmetDependenciesException;
|
||||||
use Drupal\Core\Controller\ControllerBase;
|
use Drupal\Core\Controller\ControllerBase;
|
||||||
use Drupal\Core\Extension\ThemeHandlerInterface;
|
use Drupal\Core\Extension\ThemeHandlerInterface;
|
||||||
|
use Drupal\Core\Extension\ThemeInstallerInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
|
|
@ -23,6 +24,13 @@ class ThemeController extends ControllerBase {
|
||||||
*/
|
*/
|
||||||
protected $themeHandler;
|
protected $themeHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The theme installer service.
|
||||||
|
*
|
||||||
|
* @var \Drupal\Core\Extension\ThemeInstallerInterface
|
||||||
|
*/
|
||||||
|
protected $themeInstaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new ThemeController.
|
* Constructs a new ThemeController.
|
||||||
*
|
*
|
||||||
|
|
@ -30,10 +38,13 @@ class ThemeController extends ControllerBase {
|
||||||
* The theme handler.
|
* The theme handler.
|
||||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||||
* The config factory.
|
* The config factory.
|
||||||
|
* @param \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer
|
||||||
|
* The theme installer.
|
||||||
*/
|
*/
|
||||||
public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryInterface $config_factory) {
|
public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryInterface $config_factory, ThemeInstallerInterface $theme_installer) {
|
||||||
$this->themeHandler = $theme_handler;
|
$this->themeHandler = $theme_handler;
|
||||||
$this->configFactory = $config_factory;
|
$this->configFactory = $config_factory;
|
||||||
|
$this->themeInstaller = $theme_installer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -42,7 +53,8 @@ class ThemeController extends ControllerBase {
|
||||||
public static function create(ContainerInterface $container) {
|
public static function create(ContainerInterface $container) {
|
||||||
return new static(
|
return new static(
|
||||||
$container->get('theme_handler'),
|
$container->get('theme_handler'),
|
||||||
$container->get('config.factory')
|
$container->get('config.factory'),
|
||||||
|
$container->get('theme_installer')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +86,7 @@ class ThemeController extends ControllerBase {
|
||||||
$this->messenger()->addError($this->t('%theme is the default theme and cannot be uninstalled.', ['%theme' => $themes[$theme]->info['name']]));
|
$this->messenger()->addError($this->t('%theme is the default theme and cannot be uninstalled.', ['%theme' => $themes[$theme]->info['name']]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->themeHandler->uninstall([$theme]);
|
$this->themeInstaller->uninstall([$theme]);
|
||||||
$this->messenger()->addStatus($this->t('The %theme theme has been uninstalled.', ['%theme' => $themes[$theme]->info['name']]));
|
$this->messenger()->addStatus($this->t('The %theme theme has been uninstalled.', ['%theme' => $themes[$theme]->info['name']]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +118,7 @@ class ThemeController extends ControllerBase {
|
||||||
|
|
||||||
if (isset($theme)) {
|
if (isset($theme)) {
|
||||||
try {
|
try {
|
||||||
if ($this->themeHandler->install([$theme])) {
|
if ($this->themeInstaller->install([$theme])) {
|
||||||
$themes = $this->themeHandler->listInfo();
|
$themes = $this->themeHandler->listInfo();
|
||||||
$this->messenger()->addStatus($this->t('The %theme theme has been installed.', ['%theme' => $themes[$theme]->info['name']]));
|
$this->messenger()->addStatus($this->t('The %theme theme has been installed.', ['%theme' => $themes[$theme]->info['name']]));
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +171,7 @@ class ThemeController extends ControllerBase {
|
||||||
|
|
||||||
// Check if the specified theme is one recognized by the system.
|
// Check if the specified theme is one recognized by the system.
|
||||||
// Or try to install the theme.
|
// Or try to install the theme.
|
||||||
if (isset($themes[$theme]) || $this->themeHandler->install([$theme])) {
|
if (isset($themes[$theme]) || $this->themeInstaller->install([$theme])) {
|
||||||
$themes = $this->themeHandler->listInfo();
|
$themes = $this->themeHandler->listInfo();
|
||||||
|
|
||||||
// Set the default theme.
|
// Set the default theme.
|
||||||
|
|
|
||||||
|
|
@ -1854,12 +1854,13 @@ function system_update_8014() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$theme_handler->refreshInfo();
|
$theme_handler->refreshInfo();
|
||||||
|
$theme_installer = \Drupal::service('theme_installer');
|
||||||
foreach ($theme_handler->listInfo() as $theme) {
|
foreach ($theme_handler->listInfo() as $theme) {
|
||||||
// We first check that a base theme is set because if it's set to false then
|
// We first check that a base theme is set because if it's set to false then
|
||||||
// it's unset in
|
// it's unset in
|
||||||
// \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo().
|
// \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo().
|
||||||
if (isset($theme->info['base theme']) && $theme->info['base theme'] == 'stable') {
|
if (isset($theme->info['base theme']) && $theme->info['base theme'] == 'stable') {
|
||||||
$theme_handler->install(['stable']);
|
$theme_installer->install(['stable']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class PageTest extends BrowserTestBase {
|
||||||
public function testBatchProgressPageTheme() {
|
public function testBatchProgressPageTheme() {
|
||||||
// Make sure that the page which starts the batch (an administrative page)
|
// Make sure that the page which starts the batch (an administrative page)
|
||||||
// is using a different theme than would normally be used by the batch API.
|
// is using a different theme than would normally be used by the batch API.
|
||||||
$this->container->get('theme_handler')->install(['seven', 'bartik']);
|
$this->container->get('theme_installer')->install(['seven', 'bartik']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'bartik')
|
->set('default', 'bartik')
|
||||||
->set('admin', 'seven')
|
->set('admin', 'seven')
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class AlterTest extends BrowserTestBase {
|
||||||
public function testDrupalAlter() {
|
public function testDrupalAlter() {
|
||||||
// This test depends on Bartik, so make sure that it is always the current
|
// This test depends on Bartik, so make sure that it is always the current
|
||||||
// active theme.
|
// active theme.
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('bartik'));
|
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('bartik'));
|
||||||
|
|
||||||
$array = ['foo' => 'bar'];
|
$array = ['foo' => 'bar'];
|
||||||
|
|
|
||||||
|
|
@ -247,8 +247,9 @@ class MenuRouterTest extends BrowserTestBase {
|
||||||
$this->defaultTheme = 'bartik';
|
$this->defaultTheme = 'bartik';
|
||||||
$this->adminTheme = 'seven';
|
$this->adminTheme = 'seven';
|
||||||
|
|
||||||
$theme_handler = $this->container->get('theme_handler');
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
$theme_handler->install([$this->defaultTheme, $this->adminTheme]);
|
$theme_installer = $this->container->get('theme_installer');
|
||||||
|
$theme_installer->install([$this->defaultTheme, $this->adminTheme]);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', $this->defaultTheme)
|
->set('default', $this->defaultTheme)
|
||||||
->set('admin', $this->adminTheme)
|
->set('admin', $this->adminTheme)
|
||||||
|
|
@ -305,14 +306,15 @@ class MenuRouterTest extends BrowserTestBase {
|
||||||
$this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
|
$this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page.");
|
||||||
|
|
||||||
// Now install the theme and request it again.
|
// Now install the theme and request it again.
|
||||||
$theme_handler = $this->container->get('theme_handler');
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
$theme_handler->install(['test_theme']);
|
$theme_installer = $this->container->get('theme_installer');
|
||||||
|
$theme_installer->install(['test_theme']);
|
||||||
|
|
||||||
$this->drupalGet('menu-test/theme-callback/use-test-theme');
|
$this->drupalGet('menu-test/theme-callback/use-test-theme');
|
||||||
$this->assertText('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.');
|
$this->assertText('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.');
|
||||||
$this->assertRaw('test_theme/kitten.css', "The optional theme's CSS appears on the page.");
|
$this->assertRaw('test_theme/kitten.css', "The optional theme's CSS appears on the page.");
|
||||||
|
|
||||||
$theme_handler->uninstall(['test_theme']);
|
$theme_installer->uninstall(['test_theme']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
|
||||||
$this->assertText($user_message);
|
$this->assertText($user_message);
|
||||||
|
|
||||||
// Regression test to check if title displays in Bartik on maintenance page.
|
// Regression test to check if title displays in Bartik on maintenance page.
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
$this->config('system.theme')->set('default', 'bartik')->save();
|
$this->config('system.theme')->set('default', 'bartik')->save();
|
||||||
|
|
||||||
// Logout and verify that offline message is displayed in Bartik.
|
// Logout and verify that offline message is displayed in Bartik.
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($elements[0]->getAttribute('src'), file_url_transform_relative(file_create_url($uploaded_filename)));
|
$this->assertEqual($elements[0]->getAttribute('src'), file_url_transform_relative(file_create_url($uploaded_filename)));
|
||||||
|
|
||||||
$this->container->get('theme_handler')->install(['bartik']);
|
$this->container->get('theme_installer')->install(['bartik']);
|
||||||
|
|
||||||
// Ensure only valid themes are listed in the local tasks.
|
// Ensure only valid themes are listed in the local tasks.
|
||||||
$this->drupalPlaceBlock('local_tasks_block', ['region' => 'header']);
|
$this->drupalPlaceBlock('local_tasks_block', ['region' => 'header']);
|
||||||
|
|
@ -226,7 +226,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testThemeSettingsLogo() {
|
public function testThemeSettingsLogo() {
|
||||||
// Visit Bartik's theme settings page to replace the logo.
|
// Visit Bartik's theme settings page to replace the logo.
|
||||||
$this->container->get('theme_handler')->install(['bartik']);
|
$this->container->get('theme_installer')->install(['bartik']);
|
||||||
$this->drupalGet('admin/appearance/settings/bartik');
|
$this->drupalGet('admin/appearance/settings/bartik');
|
||||||
$edit = [
|
$edit = [
|
||||||
'default_logo' => FALSE,
|
'default_logo' => FALSE,
|
||||||
|
|
@ -248,7 +248,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
* Tests the 'rendered' cache tag is cleared when saving theme settings.
|
* Tests the 'rendered' cache tag is cleared when saving theme settings.
|
||||||
*/
|
*/
|
||||||
public function testThemeSettingsRenderCacheClear() {
|
public function testThemeSettingsRenderCacheClear() {
|
||||||
$this->container->get('theme_handler')->install(['bartik']);
|
$this->container->get('theme_installer')->install(['bartik']);
|
||||||
// Ensure the frontpage is cached for anonymous users. The render cache will
|
// Ensure the frontpage is cached for anonymous users. The render cache will
|
||||||
// cleared by installing a theme.
|
// cleared by installing a theme.
|
||||||
$this->drupalLogout();
|
$this->drupalLogout();
|
||||||
|
|
@ -270,7 +270,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
* Test the administration theme functionality.
|
* Test the administration theme functionality.
|
||||||
*/
|
*/
|
||||||
public function testAdministrationTheme() {
|
public function testAdministrationTheme() {
|
||||||
$this->container->get('theme_handler')->install(['seven']);
|
$this->container->get('theme_installer')->install(['seven']);
|
||||||
|
|
||||||
// Install an administration theme and show it on the node admin pages.
|
// Install an administration theme and show it on the node admin pages.
|
||||||
$edit = [
|
$edit = [
|
||||||
|
|
@ -329,14 +329,14 @@ class ThemeTest extends BrowserTestBase {
|
||||||
* Test switching the default theme.
|
* Test switching the default theme.
|
||||||
*/
|
*/
|
||||||
public function testSwitchDefaultTheme() {
|
public function testSwitchDefaultTheme() {
|
||||||
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_installer = \Drupal::service('theme_installer');
|
||||||
// First, install Stark and set it as the default theme programmatically.
|
// First, install Stark and set it as the default theme programmatically.
|
||||||
$theme_handler->install(['stark']);
|
$theme_installer->install(['stark']);
|
||||||
$this->config('system.theme')->set('default', 'stark')->save();
|
$this->config('system.theme')->set('default', 'stark')->save();
|
||||||
|
|
||||||
// Install Bartik and set it as the default theme.
|
// Install Bartik and set it as the default theme.
|
||||||
$theme_handler->install(['bartik']);
|
$theme_installer->install(['bartik']);
|
||||||
$this->drupalGet('admin/appearance');
|
$this->drupalGet('admin/appearance');
|
||||||
$this->clickLink(t('Set as default'));
|
$this->clickLink(t('Set as default'));
|
||||||
$this->assertEqual($this->config('system.theme')->get('default'), 'bartik');
|
$this->assertEqual($this->config('system.theme')->get('default'), 'bartik');
|
||||||
|
|
@ -378,9 +378,9 @@ class ThemeTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testUninstallingThemes() {
|
public function testUninstallingThemes() {
|
||||||
// Install Bartik and set it as the default theme.
|
// Install Bartik and set it as the default theme.
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik']);
|
||||||
// Set up seven as the admin theme.
|
// Set up seven as the admin theme.
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
\Drupal::service('theme_installer')->install(['seven']);
|
||||||
$edit = [
|
$edit = [
|
||||||
'admin_theme' => 'seven',
|
'admin_theme' => 'seven',
|
||||||
'use_admin_theme' => TRUE,
|
'use_admin_theme' => TRUE,
|
||||||
|
|
@ -398,7 +398,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
$this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
|
$this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
|
||||||
|
|
||||||
// Install Stark and set it as the default theme.
|
// Install Stark and set it as the default theme.
|
||||||
\Drupal::service('theme_handler')->install(['stark']);
|
\Drupal::service('theme_installer')->install(['stark']);
|
||||||
|
|
||||||
$edit = [
|
$edit = [
|
||||||
'admin_theme' => 'stark',
|
'admin_theme' => 'stark',
|
||||||
|
|
@ -462,7 +462,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testThemeSettingsNoLogoNoFavicon() {
|
public function testThemeSettingsNoLogoNoFavicon() {
|
||||||
// Install theme with no logo and no favicon feature.
|
// Install theme with no logo and no favicon feature.
|
||||||
$this->container->get('theme_handler')->install(['test_theme_settings_features']);
|
$this->container->get('theme_installer')->install(['test_theme_settings_features']);
|
||||||
// Visit this theme's settings page.
|
// Visit this theme's settings page.
|
||||||
$this->drupalGet('admin/appearance/settings/test_theme_settings_features');
|
$this->drupalGet('admin/appearance/settings/test_theme_settings_features');
|
||||||
$edit = [];
|
$edit = [];
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class EngineNyanCatTest extends BrowserTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme_nyan_cat_engine']);
|
\Drupal::service('theme_installer')->install(['test_theme_nyan_cat_engine']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class EngineTwigTest extends BrowserTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class EntityFilteringThemeTest extends BrowserTestBase {
|
||||||
// Install all available non-testing themes.
|
// Install all available non-testing themes.
|
||||||
$listing = new ExtensionDiscovery(\Drupal::root());
|
$listing = new ExtensionDiscovery(\Drupal::root());
|
||||||
$this->themes = $listing->scan('theme', FALSE);
|
$this->themes = $listing->scan('theme', FALSE);
|
||||||
\Drupal::service('theme_handler')->install(array_keys($this->themes));
|
\Drupal::service('theme_installer')->install(array_keys($this->themes));
|
||||||
|
|
||||||
// Create a test user.
|
// Create a test user.
|
||||||
$this->user = $this->drupalCreateUser(['access content', 'access user profiles']);
|
$this->user = $this->drupalCreateUser(['access content', 'access user profiles']);
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ class ThemeInfoTest extends BrowserTestBase {
|
||||||
public static $modules = ['theme_test'];
|
public static $modules = ['theme_test'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The theme handler used in this test for enabling themes.
|
* The theme installer used in this test for enabling themes.
|
||||||
*
|
*
|
||||||
* @var \Drupal\Core\Extension\ThemeHandler
|
* @var \Drupal\Core\Extension\ThemeInstallerInterface
|
||||||
*/
|
*/
|
||||||
protected $themeHandler;
|
protected $themeInstaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The theme manager used in this test.
|
* The theme manager used in this test.
|
||||||
|
|
@ -45,7 +45,7 @@ class ThemeInfoTest extends BrowserTestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->themeHandler = $this->container->get('theme_handler');
|
$this->themeInstaller = $this->container->get('theme_installer');
|
||||||
$this->themeManager = $this->container->get('theme.manager');
|
$this->themeManager = $this->container->get('theme.manager');
|
||||||
$this->state = $this->container->get('state');
|
$this->state = $this->container->get('state');
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ class ThemeInfoTest extends BrowserTestBase {
|
||||||
* Tests stylesheets-remove.
|
* Tests stylesheets-remove.
|
||||||
*/
|
*/
|
||||||
public function testStylesheets() {
|
public function testStylesheets() {
|
||||||
$this->themeHandler->install(['test_basetheme', 'test_subtheme']);
|
$this->themeInstaller->install(['test_basetheme', 'test_subtheme']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'test_subtheme')
|
->set('default', 'test_subtheme')
|
||||||
->save();
|
->save();
|
||||||
|
|
@ -83,7 +83,7 @@ class ThemeInfoTest extends BrowserTestBase {
|
||||||
* Tests that changes to the info file are picked up.
|
* Tests that changes to the info file are picked up.
|
||||||
*/
|
*/
|
||||||
public function testChanges() {
|
public function testChanges() {
|
||||||
$this->themeHandler->install(['test_theme']);
|
$this->themeInstaller->install(['test_theme']);
|
||||||
$this->config('system.theme')->set('default', 'test_theme')->save();
|
$this->config('system.theme')->set('default', 'test_theme')->save();
|
||||||
$this->themeManager->resetActiveTheme();
|
$this->themeManager->resetActiveTheme();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class ThemeSuggestionsAlterTest extends BrowserTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class ThemeTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class TwigDebugMarkupTest extends BrowserTestBase {
|
||||||
/** @var \Drupal\Core\Render\RendererInterface $renderer */
|
/** @var \Drupal\Core\Render\RendererInterface $renderer */
|
||||||
$renderer = $this->container->get('renderer');
|
$renderer = $this->container->get('renderer');
|
||||||
$extension = twig_extension();
|
$extension = twig_extension();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->config('system.theme')->set('default', 'test_theme')->save();
|
$this->config('system.theme')->set('default', 'test_theme')->save();
|
||||||
$this->drupalCreateContentType(['type' => 'page']);
|
$this->drupalCreateContentType(['type' => 'page']);
|
||||||
// Enable debug, rebuild the service container, and clear all caches.
|
// Enable debug, rebuild the service container, and clear all caches.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class TwigExtensionTest extends BrowserTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class TwigRegistryLoaderTest extends BrowserTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme_twig_registry_loader', 'test_theme_twig_registry_loader_theme', 'test_theme_twig_registry_loader_subtheme']);
|
\Drupal::service('theme_installer')->install(['test_theme_twig_registry_loader', 'test_theme_twig_registry_loader_theme', 'test_theme_twig_registry_loader_subtheme']);
|
||||||
$this->twig = \Drupal::service('twig');
|
$this->twig = \Drupal::service('twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ class TwigSettingsTest extends BrowserTestBase {
|
||||||
*/
|
*/
|
||||||
public function testTwigCacheOverride() {
|
public function testTwigCacheOverride() {
|
||||||
$extension = twig_extension();
|
$extension = twig_extension();
|
||||||
$theme_handler = $this->container->get('theme_handler');
|
$theme_installer = $this->container->get('theme_installer');
|
||||||
$theme_handler->install(['test_theme']);
|
$theme_installer->install(['test_theme']);
|
||||||
$this->config('system.theme')->set('default', 'test_theme')->save();
|
$this->config('system.theme')->set('default', 'test_theme')->save();
|
||||||
|
|
||||||
// The registry still works on theme globals, so set them here.
|
// The registry still works on theme globals, so set them here.
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class TwigTransTest extends BrowserTestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Setup test_theme.
|
// Setup test_theme.
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->config('system.theme')->set('default', 'test_theme')->save();
|
$this->config('system.theme')->set('default', 'test_theme')->save();
|
||||||
|
|
||||||
// Create and log in as admin.
|
// Create and log in as admin.
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class FrameworkTest extends WebDriverTestBase {
|
||||||
public function testLazyLoadOverriddenCSS() {
|
public function testLazyLoadOverriddenCSS() {
|
||||||
// The test theme overrides js.module.css without an implementation,
|
// The test theme overrides js.module.css without an implementation,
|
||||||
// thereby removing it.
|
// thereby removing it.
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'test_theme')
|
->set('default', 'test_theme')
|
||||||
->save();
|
->save();
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class ThemeFormSettingsTest extends WebDriverTestBase {
|
||||||
*/
|
*/
|
||||||
public function testFormSettingsSubmissionHandler($theme) {
|
public function testFormSettingsSubmissionHandler($theme) {
|
||||||
|
|
||||||
\Drupal::service('theme_handler')->install([$theme]);
|
\Drupal::service('theme_installer')->install([$theme]);
|
||||||
|
|
||||||
$page = $this->getSession()->getPage();
|
$page = $this->getSession()->getPage();
|
||||||
$assert_session = $this->assertSession();
|
$assert_session = $this->assertSession();
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,8 @@ class MigrateThemeSettingsTest extends MigrateDrupal7TestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Install bartik theme.
|
// Install bartik and seven themes.
|
||||||
\Drupal::service('theme_handler')->install(['bartik']);
|
\Drupal::service('theme_installer')->install(['bartik', 'seven']);
|
||||||
// Install seven theme.
|
|
||||||
\Drupal::service('theme_handler')->install(['seven']);
|
|
||||||
$this->executeMigration('d7_theme_settings');
|
$this->executeMigration('d7_theme_settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class FunctionsTest extends KernelTestBase {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Enable the Classy theme.
|
// Enable the Classy theme.
|
||||||
$this->container->get('theme_handler')->install(['classy']);
|
$this->container->get('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class ThemeTest extends KernelTestBase {
|
||||||
*/
|
*/
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,8 +104,8 @@ class ThemeTest extends KernelTestBase {
|
||||||
* Test the listInfo() function.
|
* Test the listInfo() function.
|
||||||
*/
|
*/
|
||||||
public function testListThemes() {
|
public function testListThemes() {
|
||||||
|
$this->container->get('theme_installer')->install(['test_subtheme']);
|
||||||
$theme_handler = $this->container->get('theme_handler');
|
$theme_handler = $this->container->get('theme_handler');
|
||||||
$theme_handler->install(['test_subtheme']);
|
|
||||||
$themes = $theme_handler->listInfo();
|
$themes = $theme_handler->listInfo();
|
||||||
|
|
||||||
// Check if ThemeHandlerInterface::listInfo() retrieves enabled themes.
|
// Check if ThemeHandlerInterface::listInfo() retrieves enabled themes.
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class TwigNamespaceTest extends KernelTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme', 'bartik']);
|
\Drupal::service('theme_installer')->install(['test_theme', 'bartik']);
|
||||||
$this->twig = \Drupal::service('twig');
|
$this->twig = \Drupal::service('twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class ThemeTest extends TaxonomyTestBase {
|
||||||
|
|
||||||
// Make sure we are using distinct default and administrative themes for
|
// Make sure we are using distinct default and administrative themes for
|
||||||
// the duration of these tests.
|
// the duration of these tests.
|
||||||
\Drupal::service('theme_handler')->install(['bartik', 'seven']);
|
\Drupal::service('theme_installer')->install(['bartik', 'seven']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'bartik')
|
->set('default', 'bartik')
|
||||||
->set('admin', 'seven')
|
->set('admin', 'seven')
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ abstract class TourTestBasic extends TourTestBase {
|
||||||
|
|
||||||
// Make sure we are using distinct default and administrative themes for
|
// Make sure we are using distinct default and administrative themes for
|
||||||
// the duration of these tests.
|
// the duration of these tests.
|
||||||
$this->container->get('theme_handler')->install(['bartik', 'seven']);
|
$this->container->get('theme_installer')->install(['bartik', 'seven']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'bartik')
|
->set('default', 'bartik')
|
||||||
->set('admin', 'seven')
|
->set('admin', 'seven')
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ class UpdateContribTest extends UpdateTestBase {
|
||||||
// @todo https://www.drupal.org/node/2338175 base themes have to be
|
// @todo https://www.drupal.org/node/2338175 base themes have to be
|
||||||
// installed.
|
// installed.
|
||||||
// Only install the subtheme, not the base theme.
|
// Only install the subtheme, not the base theme.
|
||||||
\Drupal::service('theme_handler')->install(['update_test_subtheme']);
|
\Drupal::service('theme_installer')->install(['update_test_subtheme']);
|
||||||
|
|
||||||
// Define the initial state for core and the subtheme.
|
// Define the initial state for core and the subtheme.
|
||||||
$system_info = [
|
$system_info = [
|
||||||
|
|
@ -295,7 +295,7 @@ class UpdateContribTest extends UpdateTestBase {
|
||||||
module_load_include('compare.inc', 'update');
|
module_load_include('compare.inc', 'update');
|
||||||
|
|
||||||
// Install the subtheme.
|
// Install the subtheme.
|
||||||
\Drupal::service('theme_handler')->install(['update_test_subtheme']);
|
\Drupal::service('theme_installer')->install(['update_test_subtheme']);
|
||||||
|
|
||||||
// Add a project and initial state for base theme and subtheme.
|
// Add a project and initial state for base theme and subtheme.
|
||||||
$system_info = [
|
$system_info = [
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class UserFieldsTest extends KernelTestBase {
|
||||||
$this->installEntitySchema('user');
|
$this->installEntitySchema('user');
|
||||||
|
|
||||||
// Set up a test theme that prints the user's mail field.
|
// Set up a test theme that prints the user's mail field.
|
||||||
\Drupal::service('theme_handler')->install(['user_test_theme']);
|
\Drupal::service('theme_installer')->install(['user_test_theme']);
|
||||||
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('user_test_theme'));
|
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme('user_test_theme'));
|
||||||
// Clear the theme registry.
|
// Clear the theme registry.
|
||||||
$this->container->set('theme.registry', NULL);
|
$this->container->set('theme.registry', NULL);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class ExposedFormCheckboxesTest extends ViewTestBase {
|
||||||
*/
|
*/
|
||||||
public function testExposedFormRenderCheckboxes() {
|
public function testExposedFormRenderCheckboxes() {
|
||||||
// Use a test theme to convert multi-select elements into checkboxes.
|
// Use a test theme to convert multi-select elements into checkboxes.
|
||||||
\Drupal::service('theme_handler')->install(['views_test_checkboxes_theme']);
|
\Drupal::service('theme_installer')->install(['views_test_checkboxes_theme']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'views_test_checkboxes_theme')
|
->set('default', 'views_test_checkboxes_theme')
|
||||||
->save();
|
->save();
|
||||||
|
|
@ -142,7 +142,7 @@ class ExposedFormCheckboxesTest extends ViewTestBase {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Use a test theme to convert multi-select elements into checkboxes.
|
// Use a test theme to convert multi-select elements into checkboxes.
|
||||||
\Drupal::service('theme_handler')->install(['views_test_checkboxes_theme']);
|
\Drupal::service('theme_installer')->install(['views_test_checkboxes_theme']);
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
->set('default', 'views_test_checkboxes_theme')
|
->set('default', 'views_test_checkboxes_theme')
|
||||||
->save();
|
->save();
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class ViewsEscapingTest extends ViewTestBase {
|
||||||
$this->assertNoEscaped('<');
|
$this->assertNoEscaped('<');
|
||||||
|
|
||||||
// Install theme to test with template system.
|
// Install theme to test with template system.
|
||||||
\Drupal::service('theme_handler')->install(['views_test_theme']);
|
\Drupal::service('theme_installer')->install(['views_test_theme']);
|
||||||
|
|
||||||
// Make base theme default then test for hook invocations.
|
// Make base theme default then test for hook invocations.
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ class ViewsNoResultsBehaviorTest extends ViewTestBase {
|
||||||
$this->drupalLogin($user);
|
$this->drupalLogin($user);
|
||||||
|
|
||||||
// Set the Stark theme and use the default templates from views module.
|
// Set the Stark theme and use the default templates from views module.
|
||||||
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_installer = \Drupal::service('theme_installer');
|
||||||
$theme_handler->install(['stark']);
|
$theme_installer->install(['stark']);
|
||||||
$this->config('system.theme')->set('default', 'stark')->save();
|
$this->config('system.theme')->set('default', 'stark')->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class ViewsThemeIntegrationTest extends ViewTestBase {
|
||||||
*/
|
*/
|
||||||
public function testThemedViewPage() {
|
public function testThemedViewPage() {
|
||||||
|
|
||||||
\Drupal::service('theme_handler')->install(['test_basetheme', 'test_subtheme']);
|
\Drupal::service('theme_installer')->install(['test_basetheme', 'test_subtheme']);
|
||||||
|
|
||||||
// Make base theme default then test for hook invocations.
|
// Make base theme default then test for hook invocations.
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ class DisplayPageTest extends ViewsKernelTestBase {
|
||||||
$themes = ['bartik', 'classy', 'seven', 'stable', 'stark'];
|
$themes = ['bartik', 'classy', 'seven', 'stable', 'stark'];
|
||||||
|
|
||||||
foreach ($themes as $theme) {
|
foreach ($themes as $theme) {
|
||||||
\Drupal::service('theme_handler')->install([$theme]);
|
\Drupal::service('theme_installer')->install([$theme]);
|
||||||
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme($theme));
|
\Drupal::theme()->setActiveTheme(\Drupal::service('theme.initialization')->initTheme($theme));
|
||||||
foreach ($styles as $type => $xpath) {
|
foreach ($styles as $type => $xpath) {
|
||||||
$view = Views::getView('test_page_display');
|
$view = Views::getView('test_page_display');
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class ViewsPreprocessTest extends ViewsKernelTestBase {
|
||||||
* Tests css classes on displays are cleaned correctly.
|
* Tests css classes on displays are cleaned correctly.
|
||||||
*/
|
*/
|
||||||
public function testCssClassCleaning() {
|
public function testCssClassCleaning() {
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->config('system.theme')->set('default', 'test_theme')->save();
|
$this->config('system.theme')->set('default', 'test_theme')->save();
|
||||||
|
|
||||||
$entity = EntityTest::create();
|
$entity = EntityTest::create();
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class CustomBooleanTest extends UITestBase {
|
||||||
*/
|
*/
|
||||||
public function testCustomOptionTemplate() {
|
public function testCustomOptionTemplate() {
|
||||||
// Install theme to test with template system.
|
// Install theme to test with template system.
|
||||||
\Drupal::service('theme_handler')->install(['views_test_theme']);
|
\Drupal::service('theme_installer')->install(['views_test_theme']);
|
||||||
|
|
||||||
// Set the default theme for Views preview.
|
// Set the default theme for Views preview.
|
||||||
$this->config('system.theme')
|
$this->config('system.theme')
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class GetFilenameTest extends KernelTestBase {
|
||||||
$this->assertIdentical(drupal_get_filename('module', 'system'), 'core/modules/system/system.info.yml');
|
$this->assertIdentical(drupal_get_filename('module', 'system'), 'core/modules/system/system.info.yml');
|
||||||
|
|
||||||
// Retrieving the location of a theme.
|
// Retrieving the location of a theme.
|
||||||
\Drupal::service('theme_handler')->install(['stark']);
|
\Drupal::service('theme_installer')->install(['stark']);
|
||||||
$this->assertIdentical(drupal_get_filename('theme', 'stark'), 'core/themes/stark/stark.info.yml');
|
$this->assertIdentical(drupal_get_filename('theme', 'stark'), 'core/themes/stark/stark.info.yml');
|
||||||
|
|
||||||
// Retrieving the location of a theme engine.
|
// Retrieving the location of a theme engine.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class DefaultConfigTest extends KernelTestBase {
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install($this->themes);
|
\Drupal::service('theme_installer')->install($this->themes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class CurrentThemeConditionTest extends KernelTestBase {
|
||||||
* Tests the current theme condition.
|
* Tests the current theme condition.
|
||||||
*/
|
*/
|
||||||
public function testCurrentTheme() {
|
public function testCurrentTheme() {
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
|
|
||||||
$manager = \Drupal::service('plugin.manager.condition');
|
$manager = \Drupal::service('plugin.manager.condition');
|
||||||
/** @var $condition \Drupal\Core\Condition\ConditionInterface */
|
/** @var $condition \Drupal\Core\Condition\ConditionInterface */
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class TableTest extends KernelTestBase {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Enable the Classy theme.
|
// Enable the Classy theme.
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
|
|
||||||
$this->render($table);
|
$this->render($table);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class ElementInfoIntegrationTest extends KernelTestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->container->get('theme_handler')->install(['test_theme', 'classy']);
|
$this->container->get('theme_installer')->install(['test_theme', 'classy']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class MessageTest extends KernelTestBase {
|
||||||
*/
|
*/
|
||||||
public function testMessages() {
|
public function testMessages() {
|
||||||
// Enable the Classy theme.
|
// Enable the Classy theme.
|
||||||
\Drupal::service('theme_handler')->install(['classy']);
|
\Drupal::service('theme_installer')->install(['classy']);
|
||||||
$this->config('system.theme')->set('default', 'classy')->save();
|
$this->config('system.theme')->set('default', 'classy')->save();
|
||||||
|
|
||||||
\Drupal::messenger()->addError('An error occurred');
|
\Drupal::messenger()->addError('An error occurred');
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class RegistryTest extends KernelTestBase {
|
||||||
*/
|
*/
|
||||||
public function testMultipleSubThemes() {
|
public function testMultipleSubThemes() {
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_handler = \Drupal::service('theme_handler');
|
||||||
$theme_handler->install(['test_basetheme', 'test_subtheme', 'test_subsubtheme']);
|
\Drupal::service('theme_installer')->install(['test_basetheme', 'test_subtheme', 'test_subsubtheme']);
|
||||||
|
|
||||||
$registry_subsub_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subsubtheme');
|
$registry_subsub_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subsubtheme');
|
||||||
$registry_subsub_theme->setThemeManager(\Drupal::theme());
|
$registry_subsub_theme->setThemeManager(\Drupal::theme());
|
||||||
|
|
@ -109,7 +109,7 @@ class RegistryTest extends KernelTestBase {
|
||||||
*/
|
*/
|
||||||
public function testSuggestionPreprocessFunctions() {
|
public function testSuggestionPreprocessFunctions() {
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_handler = \Drupal::service('theme_handler');
|
||||||
$theme_handler->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
|
|
||||||
$registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
|
$registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
|
||||||
$registry_theme->setThemeManager(\Drupal::theme());
|
$registry_theme->setThemeManager(\Drupal::theme());
|
||||||
|
|
@ -151,7 +151,7 @@ class RegistryTest extends KernelTestBase {
|
||||||
|
|
||||||
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_handler = \Drupal::service('theme_handler');
|
||||||
$theme_handler->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->config('system.theme')->set('default', 'test_theme')->save();
|
$this->config('system.theme')->set('default', 'test_theme')->save();
|
||||||
|
|
||||||
$registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
|
$registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
|
||||||
|
|
@ -197,7 +197,7 @@ class RegistryTest extends KernelTestBase {
|
||||||
*/
|
*/
|
||||||
public function testThemeTemplatesRegisteredByModules() {
|
public function testThemeTemplatesRegisteredByModules() {
|
||||||
$theme_handler = \Drupal::service('theme_handler');
|
$theme_handler = \Drupal::service('theme_handler');
|
||||||
$theme_handler->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
|
|
||||||
$registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
|
$registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme');
|
||||||
$registry_theme->setThemeManager(\Drupal::theme());
|
$registry_theme->setThemeManager(\Drupal::theme());
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ class StableThemeTest extends KernelTestBase {
|
||||||
public static $modules = ['system'];
|
public static $modules = ['system'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The theme handler.
|
* The theme installer.
|
||||||
*
|
*
|
||||||
* @var \Drupal\Core\Extension\ThemeHandlerInterface
|
* @var \Drupal\Core\Extension\ThemeInstallerInterface
|
||||||
*/
|
*/
|
||||||
protected $themeHandler;
|
protected $themeInstaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The theme manager.
|
* The theme manager.
|
||||||
|
|
@ -38,7 +38,7 @@ class StableThemeTest extends KernelTestBase {
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->themeHandler = $this->container->get('theme_handler');
|
$this->themeInstaller = $this->container->get('theme_installer');
|
||||||
$this->themeManager = $this->container->get('theme.manager');
|
$this->themeManager = $this->container->get('theme.manager');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ class StableThemeTest extends KernelTestBase {
|
||||||
* Ensures Stable is used by default when no base theme has been defined.
|
* Ensures Stable is used by default when no base theme has been defined.
|
||||||
*/
|
*/
|
||||||
public function testStableIsDefault() {
|
public function testStableIsDefault() {
|
||||||
$this->themeHandler->install(['test_stable']);
|
$this->themeInstaller->install(['test_stable']);
|
||||||
$this->config('system.theme')->set('default', 'test_stable')->save();
|
$this->config('system.theme')->set('default', 'test_stable')->save();
|
||||||
$theme = $this->themeManager->getActiveTheme();
|
$theme = $this->themeManager->getActiveTheme();
|
||||||
$base_themes = $theme->getBaseThemeExtensions();
|
$base_themes = $theme->getBaseThemeExtensions();
|
||||||
|
|
@ -58,7 +58,7 @@ class StableThemeTest extends KernelTestBase {
|
||||||
* Tests opting out of Stable by setting the base theme to false.
|
* Tests opting out of Stable by setting the base theme to false.
|
||||||
*/
|
*/
|
||||||
public function testWildWest() {
|
public function testWildWest() {
|
||||||
$this->themeHandler->install(['test_wild_west']);
|
$this->themeInstaller->install(['test_wild_west']);
|
||||||
$this->config('system.theme')->set('default', 'test_wild_west')->save();
|
$this->config('system.theme')->set('default', 'test_wild_west')->save();
|
||||||
$theme = $this->themeManager->getActiveTheme();
|
$theme = $this->themeManager->getActiveTheme();
|
||||||
/** @var \Drupal\Core\Theme\ActiveTheme $base_theme */
|
/** @var \Drupal\Core\Theme\ActiveTheme $base_theme */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\KernelTests\Core\Theme;
|
||||||
|
|
||||||
|
use Drupal\KernelTests\KernelTestBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests deprecated methods of ThemeHandler.
|
||||||
|
*
|
||||||
|
* @coversDefaultClass \Drupal\Core\Extension\ThemeHandler
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
|
class ThemeHandlerLegacyTest extends KernelTestBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The theme handler.
|
||||||
|
*
|
||||||
|
* @var \Drupal\Core\Extension\ThemeHandlerInterface
|
||||||
|
*/
|
||||||
|
protected $themeHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
$this->themeHandler = \Drupal::service('theme_handler');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::install
|
||||||
|
* @covers ::uninstall
|
||||||
|
* @expectedDeprecation \Drupal\Core\Extension\ThemeHandlerInterface::install() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Extension\ThemeInstallerInterface::install() instead. See https://www.drupal.org/node/3017233
|
||||||
|
* @expectedDeprecation \Drupal\Core\Extension\ThemeHandlerInterface::uninstall() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Extension\ThemeInstallerInterface::uninstall() instead. See https://www.drupal.org/node/3017233
|
||||||
|
*/
|
||||||
|
public function testInstallUninstall() {
|
||||||
|
$theme = 'seven';
|
||||||
|
|
||||||
|
$this->assertFalse($this->themeHandler->themeExists($theme));
|
||||||
|
$this->assertEquals(TRUE, $this->themeHandler->install([$theme]));
|
||||||
|
$this->assertTrue($this->themeHandler->themeExists($theme));
|
||||||
|
$this->themeHandler->uninstall([$theme]);
|
||||||
|
$this->assertFalse($this->themeHandler->themeExists($theme));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$this->assertFalse(array_keys($themes));
|
$this->assertFalse(array_keys($themes));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::install() throws UnknownExtensionException upon installing a non-existing theme.';
|
$message = 'ThemeInstaller::install() throws UnknownExtensionException upon installing a non-existing theme.';
|
||||||
$this->themeInstaller()->install([$name]);
|
$this->themeInstaller()->install([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +128,7 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$name = 'test_theme_having_veery_long_name_which_is_too_long';
|
$name = 'test_theme_having_veery_long_name_which_is_too_long';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::install() throws ExtensionNameLengthException upon installing a theme with a too long name.';
|
$message = 'ThemeInstaller::install() throws ExtensionNameLengthException upon installing a theme with a too long name.';
|
||||||
$this->themeInstaller()->install([$name]);
|
$this->themeInstaller()->install([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
|
|
@ -151,8 +151,8 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$this->assertTrue(isset($themes[$other_name]));
|
$this->assertTrue(isset($themes[$other_name]));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::uninstall() throws InvalidArgumentException upon disabling default theme.';
|
$message = 'ThemeInstaller::uninstall() throws InvalidArgumentException upon disabling default theme.';
|
||||||
$this->themeHandler()->uninstall([$name]);
|
$this->themeInstaller()->uninstall([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
catch (\InvalidArgumentException $e) {
|
catch (\InvalidArgumentException $e) {
|
||||||
|
|
@ -178,8 +178,8 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$this->assertTrue(isset($themes[$other_name]));
|
$this->assertTrue(isset($themes[$other_name]));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::uninstall() throws InvalidArgumentException upon disabling admin theme.';
|
$message = 'ThemeInstaller::uninstall() throws InvalidArgumentException upon disabling admin theme.';
|
||||||
$this->themeHandler()->uninstall([$name]);
|
$this->themeInstaller()->uninstall([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
catch (\InvalidArgumentException $e) {
|
catch (\InvalidArgumentException $e) {
|
||||||
|
|
@ -216,7 +216,7 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$this->themeInstaller()->install([$sub_name]);
|
$this->themeInstaller()->install([$sub_name]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::install() throws InvalidArgumentException upon uninstalling base theme before sub theme.';
|
$message = 'ThemeInstaller::install() throws InvalidArgumentException upon uninstalling base theme before sub theme.';
|
||||||
$this->themeInstaller()->uninstall([$name]);
|
$this->themeInstaller()->uninstall([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
|
|
@ -246,7 +246,7 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$this->assertFalse(array_keys($themes));
|
$this->assertFalse(array_keys($themes));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::uninstall() throws UnknownExtensionException upon uninstalling a non-existing theme.';
|
$message = 'ThemeInstaller::uninstall() throws UnknownExtensionException upon uninstalling a non-existing theme.';
|
||||||
$this->themeInstaller()->uninstall([$name]);
|
$this->themeInstaller()->uninstall([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
|
|
@ -288,7 +288,7 @@ class ThemeInstallerTest extends KernelTestBase {
|
||||||
$name = 'test_basetheme';
|
$name = 'test_basetheme';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$message = 'ThemeHandler::uninstall() throws UnknownExtensionException upon uninstalling a theme that is not installed.';
|
$message = 'ThemeInstaller::uninstall() throws UnknownExtensionException upon uninstalling a theme that is not installed.';
|
||||||
$this->themeInstaller()->uninstall([$name]);
|
$this->themeInstaller()->uninstall([$name]);
|
||||||
$this->fail($message);
|
$this->fail($message);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class ThemeSettingsTest extends KernelTestBase {
|
||||||
$name = 'test_basetheme';
|
$name = 'test_basetheme';
|
||||||
$path = $this->availableThemes[$name]->getPath();
|
$path = $this->availableThemes[$name]->getPath();
|
||||||
$this->assertTrue(file_exists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"));
|
$this->assertTrue(file_exists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"));
|
||||||
$this->container->get('theme_handler')->install([$name]);
|
$this->container->get('theme_installer')->install([$name]);
|
||||||
$this->assertIdentical(theme_get_setting('base', $name), 'only');
|
$this->assertIdentical(theme_get_setting('base', $name), 'only');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ class ThemeSettingsTest extends KernelTestBase {
|
||||||
$name = 'stark';
|
$name = 'stark';
|
||||||
$path = $this->availableThemes[$name]->getPath();
|
$path = $this->availableThemes[$name]->getPath();
|
||||||
$this->assertFalse(file_exists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"));
|
$this->assertFalse(file_exists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"));
|
||||||
$this->container->get('theme_handler')->install([$name]);
|
$this->container->get('theme_installer')->install([$name]);
|
||||||
$this->assertNotNull(theme_get_setting('features.favicon', $name));
|
$this->assertNotNull(theme_get_setting('features.favicon', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,9 +64,11 @@ class ThemeSettingsTest extends KernelTestBase {
|
||||||
* Tests that the default logo config can be overridden.
|
* Tests that the default logo config can be overridden.
|
||||||
*/
|
*/
|
||||||
public function testLogoConfig() {
|
public function testLogoConfig() {
|
||||||
|
/** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
|
||||||
|
$theme_installer = $this->container->get('theme_installer');
|
||||||
|
$theme_installer->install(['stark']);
|
||||||
/** @var \Drupal\Core\Extension\ThemeHandler $theme_handler */
|
/** @var \Drupal\Core\Extension\ThemeHandler $theme_handler */
|
||||||
$theme_handler = $this->container->get('theme_handler');
|
$theme_handler = $this->container->get('theme_handler');
|
||||||
$theme_handler->install(['stark']);
|
|
||||||
$theme = $theme_handler->getTheme('stark');
|
$theme = $theme_handler->getTheme('stark');
|
||||||
|
|
||||||
// Tests default behaviour.
|
// Tests default behaviour.
|
||||||
|
|
@ -98,7 +100,7 @@ class ThemeSettingsTest extends KernelTestBase {
|
||||||
$expected = '/' . $theme->getPath() . '/logo_relative_path.gif';
|
$expected = '/' . $theme->getPath() . '/logo_relative_path.gif';
|
||||||
$this->assertEquals($expected, theme_get_setting('logo.url', 'stark'));
|
$this->assertEquals($expected, theme_get_setting('logo.url', 'stark'));
|
||||||
|
|
||||||
$theme_handler->install(['test_theme']);
|
$theme_installer->install(['test_theme']);
|
||||||
$theme_handler->setDefault('test_theme');
|
$theme_handler->setDefault('test_theme');
|
||||||
$theme = $theme_handler->getTheme('test_theme');
|
$theme = $theme_handler->getTheme('test_theme');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class TwigWhiteListTest extends KernelTestBase {
|
||||||
*/
|
*/
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
\Drupal::service('theme_handler')->install(['test_theme']);
|
\Drupal::service('theme_installer')->install(['test_theme']);
|
||||||
$this->installSchema('system', ['sequences']);
|
$this->installSchema('system', ['sequences']);
|
||||||
$this->installEntitySchema('node');
|
$this->installEntitySchema('node');
|
||||||
$this->installEntitySchema('user');
|
$this->installEntitySchema('user');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue