Commit 688fab7b authored by Dries's avatar Dries

Issue #2390445 by Gábor Hojtsy: System module tests don't pass config schema check

parent 3e336074
...@@ -51,31 +51,27 @@ class RdfMapping extends ConfigEntityBase implements RdfMappingInterface { ...@@ -51,31 +51,27 @@ class RdfMapping extends ConfigEntityBase implements RdfMappingInterface {
* *
* @var array * @var array
*/ */
protected $types; protected $types = array();
/** /**
* The mappings for fields on this bundle. * The mappings for fields on this bundle.
* *
* @var array * @var array
*/ */
protected $fieldMappings; protected $fieldMappings = array();
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getPreparedBundleMapping() { public function getPreparedBundleMapping() {
$types = array(); return array('types' => $this->types);
if (isset($this->types)) {
$types = $this->types;
}
return array('types' => $types);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getBundleMapping() { public function getBundleMapping() {
if (isset($this->types)) { if (!empty($this->types)) {
return array('types' => $this->types); return array('types' => $this->types);
} }
return array(); return array();
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
* Implements hook_schema(). * Implements hook_schema().
*/ */
function shortcut_schema() { function shortcut_schema() {
$schema['shortcut_set_users'] = array( $schema['shortcut_set_users'] = array(
'description' => 'Maps users to shortcut sets.', 'description' => 'Maps users to shortcut sets.',
'fields' => array( 'fields' => array(
...@@ -49,3 +48,25 @@ function shortcut_schema() { ...@@ -49,3 +48,25 @@ function shortcut_schema() {
return $schema; return $schema;
} }
/**
* Implements hook_install().
*/
function shortcut_install() {
// Theme settings are not configuration entities and cannot depend on modules
// so to set a module-specific setting, we need to set it with logic.
if (\Drupal::service('theme_handler')->themeExists('seven')) {
\Drupal::config('seven.settings')->set('third_party_settings.shortcut.module_link', TRUE)->save();
}
}
/**
* Implements hook_uninstall().
*/
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::config('seven.settings')->clear('third_party_settings.shortcut.module_link')->save();
}
}
...@@ -396,3 +396,16 @@ function shortcut_toolbar() { ...@@ -396,3 +396,16 @@ function shortcut_toolbar() {
return $items; return $items;
} }
/**
* Implements hook_themes_installed().
*/
function shortcut_themes_installed($theme_list) {
if (in_array('seven', $theme_list)) {
// Theme settings are not configuration entities and cannot depend on modules
// so to set a module-specific setting, we need to set it with logic.
if (\Drupal::moduleHandler()->moduleExists('shortcut')) {
\Drupal::config('seven.settings')->set('third_party_settings.shortcut.module_link', TRUE)->save();
}
}
}
...@@ -182,7 +182,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = ...@@ -182,7 +182,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme =
); );
} }
if ((!$theme) || in_array('favicon', $features) && $this->moduleHandler->moduleExists('file')) { if (((!$theme) || in_array('favicon', $features)) && $this->moduleHandler->moduleExists('file')) {
$form['favicon'] = array( $form['favicon'] = array(
'#type' => 'details', '#type' => 'details',
'#title' => t('Shortcut icon settings'), '#title' => t('Shortcut icon settings'),
...@@ -390,19 +390,19 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -390,19 +390,19 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// and use it in place of the default theme-provided file. // and use it in place of the default theme-provided file.
if ($this->moduleHandler->moduleExists('file')) { if ($this->moduleHandler->moduleExists('file')) {
if ($file = $values['logo_upload']) { if ($file = $values['logo_upload']) {
unset($values['logo_upload']);
$filename = file_unmanaged_copy($file->getFileUri()); $filename = file_unmanaged_copy($file->getFileUri());
$values['default_logo'] = 0; $values['default_logo'] = 0;
$values['logo_path'] = $filename; $values['logo_path'] = $filename;
$values['toggle_logo'] = 1; $values['toggle_logo'] = 1;
} }
if ($file = $values['favicon_upload']) { if ($file = $values['favicon_upload']) {
unset($values['favicon_upload']);
$filename = file_unmanaged_copy($file->getFileUri()); $filename = file_unmanaged_copy($file->getFileUri());
$values['default_favicon'] = 0; $values['default_favicon'] = 0;
$values['favicon_path'] = $filename; $values['favicon_path'] = $filename;
$values['toggle_favicon'] = 1; $values['toggle_favicon'] = 1;
} }
unset($values['logo_upload']);
unset($values['favicon_upload']);
// If the user entered a path relative to the system files directory for // If the user entered a path relative to the system files directory for
// a logo or favicon, store a public:// URI so the theme system can handle it. // a logo or favicon, store a public:// URI so the theme system can handle it.
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
*/ */
class PageTest extends WebTestBase { class PageTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
*/ */
class EntityViewControllerTest extends WebTestBase { class EntityViewControllerTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
*/ */
class ThemeHandlerTest extends KernelTestBase { class ThemeHandlerTest extends KernelTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
*/ */
class FormObjectTest extends SystemConfigFormTestBase { class FormObjectTest extends SystemConfigFormTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
*/ */
class BreadcrumbTest extends MenuTestBase { class BreadcrumbTest extends MenuTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
...@@ -41,7 +50,6 @@ protected function setUp() { ...@@ -41,7 +50,6 @@ protected function setUp() {
// presence on the page, so we need to ensure that the Tools block will be // presence on the page, so we need to ensure that the Tools block will be
// displayed in the admin theme. // displayed in the admin theme.
$this->drupalPlaceBlock('system_menu_block:tools', array( $this->drupalPlaceBlock('system_menu_block:tools', array(
'machine' => 'system_menu_tools',
'region' => 'content', 'region' => 'content',
'theme' => \Drupal::config('system.theme')->get('admin'), 'theme' => \Drupal::config('system.theme')->get('admin'),
)); ));
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
*/ */
class MenuRouterTest extends WebTestBase { class MenuRouterTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
...@@ -19,6 +19,15 @@ ...@@ -19,6 +19,15 @@
*/ */
class PageTitleTest extends WebTestBase { class PageTitleTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
*/ */
class ThemeTest extends WebTestBase { class ThemeTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* Modules to enable. * Modules to enable.
* *
......
form_test.object:
type: mapping
label: 'Test form'
mapping:
bananas:
type: string
label: 'Bananas'
third_party_settings:
shortcut:
module_link: true
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