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 {
*
* @var array
*/
protected $types;
protected $types = array();
/**
* The mappings for fields on this bundle.
*
* @var array
*/
protected $fieldMappings;
protected $fieldMappings = array();
/**
* {@inheritdoc}
*/
public function getPreparedBundleMapping() {
$types = array();
if (isset($this->types)) {
$types = $this->types;
}
return array('types' => $types);
return array('types' => $this->types);
}
/**
* {@inheritdoc}
*/
public function getBundleMapping() {
if (isset($this->types)) {
if (!empty($this->types)) {
return array('types' => $this->types);
}
return array();
......
......@@ -12,7 +12,6 @@
* Implements hook_schema().
*/
function shortcut_schema() {
$schema['shortcut_set_users'] = array(
'description' => 'Maps users to shortcut sets.',
'fields' => array(
......@@ -49,3 +48,25 @@ function shortcut_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() {
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 =
);
}
if ((!$theme) || in_array('favicon', $features) && $this->moduleHandler->moduleExists('file')) {
if (((!$theme) || in_array('favicon', $features)) && $this->moduleHandler->moduleExists('file')) {
$form['favicon'] = array(
'#type' => 'details',
'#title' => t('Shortcut icon settings'),
......@@ -390,19 +390,19 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// and use it in place of the default theme-provided file.
if ($this->moduleHandler->moduleExists('file')) {
if ($file = $values['logo_upload']) {
unset($values['logo_upload']);
$filename = file_unmanaged_copy($file->getFileUri());
$values['default_logo'] = 0;
$values['logo_path'] = $filename;
$values['toggle_logo'] = 1;
}
if ($file = $values['favicon_upload']) {
unset($values['favicon_upload']);
$filename = file_unmanaged_copy($file->getFileUri());
$values['default_favicon'] = 0;
$values['favicon_path'] = $filename;
$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
// a logo or favicon, store a public:// URI so the theme system can handle it.
......
......@@ -16,6 +16,15 @@
*/
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.
*
......
......@@ -16,6 +16,15 @@
*/
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.
*
......
......@@ -18,6 +18,15 @@
*/
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.
*
......
......@@ -17,6 +17,15 @@
*/
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.
*
......
......@@ -18,6 +18,15 @@
*/
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.
*
......@@ -41,7 +50,6 @@ protected function setUp() {
// presence on the page, so we need to ensure that the Tools block will be
// displayed in the admin theme.
$this->drupalPlaceBlock('system_menu_block:tools', array(
'machine' => 'system_menu_tools',
'region' => 'content',
'theme' => \Drupal::config('system.theme')->get('admin'),
));
......
......@@ -16,6 +16,15 @@
*/
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.
*
......
......@@ -19,6 +19,15 @@
*/
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.
*
......
......@@ -18,6 +18,15 @@
*/
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.
*
......
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