Commit 77f8dc52 authored by Dries's avatar Dries

Issue #2263201 by alexpott: ConfigImportUITest has a random failure.

parent af56f3c3
...@@ -133,10 +133,8 @@ public function getDefault() { ...@@ -133,10 +133,8 @@ public function getDefault() {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setDefault($name) { public function setDefault($name) {
if (!isset($this->list)) { $list = $this->listInfo();
$this->listInfo(); if (!isset($list[$name])) {
}
if (!isset($this->list[$name])) {
throw new \InvalidArgumentException("$name theme is not enabled."); throw new \InvalidArgumentException("$name theme is not enabled.");
} }
$this->configFactory->get('system.theme') $this->configFactory->get('system.theme')
...@@ -275,10 +273,11 @@ public function enable(array $theme_list, $enable_dependencies = TRUE) { ...@@ -275,10 +273,11 @@ public function enable(array $theme_list, $enable_dependencies = TRUE) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function disable(array $theme_list) { public function disable(array $theme_list) {
$list = $this->listInfo();
$theme_config = $this->configFactory->get('system.theme'); $theme_config = $this->configFactory->get('system.theme');
foreach ($theme_list as $key) { foreach ($theme_list as $key) {
if (!isset($this->list[$key])) { if (!isset($list[$key])) {
throw new \InvalidArgumentException("Unknown theme: $key."); throw new \InvalidArgumentException("Unknown theme: $key.");
} }
if ($key === $theme_config->get('default')) { if ($key === $theme_config->get('default')) {
...@@ -289,9 +288,9 @@ public function disable(array $theme_list) { ...@@ -289,9 +288,9 @@ public function disable(array $theme_list) {
} }
// Base themes cannot be disabled if sub themes are enabled, and if they // Base themes cannot be disabled if sub themes are enabled, and if they
// are not disabled at the same time. // are not disabled at the same time.
if (!empty($this->list[$key]->sub_themes)) { if (!empty($list[$key]->sub_themes)) {
foreach ($this->list[$key]->sub_themes as $sub_key => $sub_label) { foreach ($list[$key]->sub_themes as $sub_key => $sub_label) {
if (isset($this->list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) { if (isset($list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) {
throw new \InvalidArgumentException("The base theme $key cannot be disabled, because theme $sub_key depends on it."); throw new \InvalidArgumentException("The base theme $key cannot be disabled, because theme $sub_key depends on it.");
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment