Issue #2678770 by alexpott, tstoeckler, Gábor Hojtsy: Random fail with third party shortcut settings schema on seven theme

8.1.x
effulgentsia 2016-03-02 15:17:20 -08:00
parent 133989c35d
commit 50ca110791
2 changed files with 37 additions and 1 deletions

View File

@ -64,6 +64,6 @@ function shortcut_uninstall() {
// Theme settings are not configuration entities and cannot depend on modules
// so to unset a module-specific setting, we need to unset it with logic.
if (\Drupal::service('theme_handler')->themeExists('seven')) {
\Drupal::configFactory()->getEditable('seven.settings')->clear('third_party_settings.shortcut.module_link')->save(TRUE);
\Drupal::configFactory()->getEditable('seven.settings')->clear('third_party_settings.shortcut')->save(TRUE);
}
}

View File

@ -0,0 +1,36 @@
<?php
/**
* @file
* Contains \Drupal\Tests\shortcut\Kernel\ShortcutSevenIntegrationTest.
*/
namespace Drupal\Tests\shortcut\Kernel;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests shortcut_install() and shortcut_uninstall().
*
* @group shortcut
*/
class ShortcutSevenIntegrationTest extends KernelTestBase {
public static $modules = ['system'];
/**
* Tests shortcut_install() and shortcut_uninstall().
*/
public function testInstallUninstall() {
// Install seven.
\Drupal::service('theme_installer')->install(['seven']);
$this->assertNull($this->config('seven.settings')->get('third_party_settings.shortcut'), 'There are no shortcut settings in seven.settings.');
\Drupal::service('module_installer')->install(['shortcut']);
$this->assertTrue($this->config('seven.settings')->get('third_party_settings.shortcut.module_link'), 'The shortcut module_link setting is in seven.settings.');
\Drupal::service('module_installer')->uninstall(['shortcut']);
$this->assertNull($this->config('seven.settings')->get('third_party_settings.shortcut'), 'There are no shortcut settings in seven.settings.');
}
}