Commit b175ecc4 authored by alexpott's avatar alexpott

Issue #2387141 by Gábor Hojtsy: Missing field configuration schemas across core tests

parent 68baffe7
...@@ -154,7 +154,7 @@ protected function verifyUnicornEditorConfiguration($format_id, $foo = 'bar') { ...@@ -154,7 +154,7 @@ protected function verifyUnicornEditorConfiguration($format_id, $foo = 'bar') {
$settings = $editor->getSettings(); $settings = $editor->getSettings();
$this->assertIdentical($editor->getEditor(), 'unicorn', 'The text editor is configured correctly.'); $this->assertIdentical($editor->getEditor(), 'unicorn', 'The text editor is configured correctly.');
$this->assertIdentical($settings['foo'], $foo, 'The text editor settings are stored correctly.'); $this->assertIdentical($settings['foo'], $foo, 'The text editor settings are stored correctly.');
$this->assertIdentical($settings['ponies too'], true, 'The text editor defaults are retrieved correctly.'); $this->assertIdentical($settings['ponies_too'], true, 'The text editor defaults are retrieved correctly.');
$this->assertIdentical($settings['rainbows'], true, 'The text editor defaults added by hook_editor_settings_defaults() are retrieved correctly.'); $this->assertIdentical($settings['rainbows'], true, 'The text editor defaults added by hook_editor_settings_defaults() are retrieved correctly.');
$this->assertIdentical($settings['sparkles'], false, 'The text editor defaults modified by hook_editor_settings_defaults_alter() are retrieved correctly.'); $this->assertIdentical($settings['sparkles'], false, 'The text editor defaults modified by hook_editor_settings_defaults_alter() are retrieved correctly.');
$this->drupalGet('admin/config/content/formats/manage/'. $format_id); $this->drupalGet('admin/config/content/formats/manage/'. $format_id);
......
...@@ -24,6 +24,17 @@ ...@@ -24,6 +24,17 @@
*/ */
class QuickEditIntegrationTest extends QuickEditTestBase { class QuickEditIntegrationTest extends QuickEditTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @todo Altering not schema compatible. https://www.drupal.org/node/2389697
*
* @var bool
*/
protected $strictConfigSchema = FALSE;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
# Schema for the configuration files of the Editor test module.
editor.settings.unicorn:
type: mapping
label: 'Unicorn settings'
mapping:
ponies_too:
type: string
label: 'Ponies too'
...@@ -28,7 +28,7 @@ class UnicornEditor extends EditorBase { ...@@ -28,7 +28,7 @@ class UnicornEditor extends EditorBase {
* {@inheritdoc} * {@inheritdoc}
*/ */
function getDefaultSettings() { function getDefaultSettings() {
return array('ponies too' => TRUE); return array('ponies_too' => TRUE);
} }
/** /**
...@@ -49,7 +49,7 @@ function settingsForm(array $form, FormStateInterface $form_state, EditorEntity ...@@ -49,7 +49,7 @@ function settingsForm(array $form, FormStateInterface $form_state, EditorEntity
function getJSSettings(EditorEntity $editor) { function getJSSettings(EditorEntity $editor) {
$js_settings = array(); $js_settings = array();
$settings = $editor->getSettings(); $settings = $editor->getSettings();
if ($settings['ponies too']) { if ($settings['ponies_too']) {
$js_settings['ponyModeEnabled'] = TRUE; $js_settings['ponyModeEnabled'] = TRUE;
} }
return $js_settings; return $js_settings;
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
*/ */
class SelectionTest extends WebTestBase { class SelectionTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
public static $modules = array('node', 'views', 'entity_reference', 'entity_reference_test', 'entity_test'); public static $modules = array('node', 'views', 'entity_reference', 'entity_reference_test', 'entity_test');
/** /**
...@@ -51,7 +60,6 @@ public function testSelectionHandler() { ...@@ -51,7 +60,6 @@ public function testSelectionHandler() {
'settings' => array( 'settings' => array(
'handler' => 'views', 'handler' => 'views',
'handler_settings' => array( 'handler_settings' => array(
'target_bundles' => array(),
'view' => array( 'view' => array(
'view_name' => 'test_entity_reference', 'view_name' => 'test_entity_reference',
'display_name' => 'entity_reference_1', 'display_name' => 'entity_reference_1',
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
*/ */
class DisplayApiTest extends FieldUnitTestBase { class DisplayApiTest extends FieldUnitTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
/** /**
* The field name to use in this test. * The field name to use in this test.
* *
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
*/ */
class FieldImportDeleteUninstallUiTest extends FieldTestBase { class FieldImportDeleteUninstallUiTest extends FieldTestBase {
/**
* 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 FormTest extends FieldTestBase { class FormTest extends FieldTestBase {
/**
* 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.
* *
...@@ -587,7 +596,7 @@ function testHiddenField() { ...@@ -587,7 +596,7 @@ function testHiddenField() {
// Update the field to remove the default value, and switch to the default // Update the field to remove the default value, and switch to the default
// widget. // widget.
$this->field->default_value = NULL; $this->field->default_value = array();
$this->field->save(); $this->field->save();
entity_get_form_display($entity_type, $this->field->bundle, 'default') entity_get_form_display($entity_type, $this->field->bundle, 'default')
->setComponent($this->field->getName(), array( ->setComponent($this->field->getName(), array(
......
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
*/ */
class ShapeItemTest extends FieldUnitTestBase { class ShapeItemTest extends FieldUnitTestBase {
/**
* 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.
* *
......
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
*/ */
class TestItemWithDependenciesTest extends FieldUnitTestBase { class TestItemWithDependenciesTest extends FieldUnitTestBase {
/**
* 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.
* *
......
field.formatter.settings.field_plugins_test_text_formatter:
type: field.formatter.settings.text_trimmed
label: 'Test text formatter display format settings'
field.widget.settings.field_plugins_test_text_widget:
type: field.widget.settings.text_textfield
label: 'Test text field widget settings'
field.formatter.settings.field_test_default:
type: mapping
label: 'Field test default display format settings'
mapping:
test_formatter_setting:
type: string
label: 'Test setting'
field.formatter.settings.field_test_multiple: field.formatter.settings.field_test_multiple:
type: mapping type: mapping
label: 'field_test display format settings' label: 'Multiple field test display format settings'
mapping: mapping:
test_formatter_setting_multiple: test_formatter_setting_multiple:
type: string type: string
...@@ -9,9 +17,33 @@ field.formatter.settings.field_test_multiple: ...@@ -9,9 +17,33 @@ field.formatter.settings.field_test_multiple:
type: boolean type: boolean
label: 'Test altering' label: 'Test altering'
field.formatter.settings.field_empty_setting:
type: mapping
label: 'Empty setting field display format settings'
mapping:
field_empty_setting:
type: string
label: 'Test setting'
field.formatter.settings.field_test_with_prepare_view:
type: mapping
label: 'Field prepare step display format settings'
mapping:
test_formatter_setting_additional:
type: string
label: 'Test setting'
field.widget.settings.test_field_widget:
type: mapping
label: 'Test field widget settings'
mapping:
test_widget_setting:
type: string
label: 'Test setting'
field.widget.settings.test_field_widget_multiple: field.widget.settings.test_field_widget_multiple:
type: mapping type: mapping
label: 'field_test display format settings' label: 'Test multiple field widget settings'
mapping: mapping:
test_widget_setting_multiple: test_widget_setting_multiple:
type: string type: string
...@@ -19,7 +51,7 @@ field.widget.settings.test_field_widget_multiple: ...@@ -19,7 +51,7 @@ field.widget.settings.test_field_widget_multiple:
field.storage_settings.test_field: field.storage_settings.test_field:
type: mapping type: mapping
label: 'Test field settings' label: 'Test field storage settings'
mapping: mapping:
test_field_storage_setting: test_field_storage_setting:
type: string type: string
...@@ -31,14 +63,30 @@ field.storage_settings.test_field: ...@@ -31,14 +63,30 @@ field.storage_settings.test_field:
type: string type: string
label: 'An unchangeable field storage setting' label: 'An unchangeable field storage setting'
field.storage_settings.test_field_with_dependencies:
type: field.storage_settings.test_field
label: 'Test field with dependencies storage settings'
field.storage_settings.hidden_test_field:
type: field.storage_settings.test_field
label: 'Hidden test field storage settings'
field.field_settings.test_field: field.field_settings.test_field:
type: mapping type: mapping
label: 'Test field settings' label: 'Test field field settings'
mapping: mapping:
test_field_setting: test_field_setting:
type: string type: string
label: 'Test field setting' label: 'Test field setting'
field.field_settings.test_field_with_dependencies:
type: field.field_settings.test_field
label: 'Test field with dependencies field settings'
field.field_settings.hidden_test_field:
type: field.field_settings.test_field
label: 'Hidden test field field settings'
field.value.test_field: field.value.test_field:
type: mapping type: mapping
label: 'Default value' label: 'Default value'
...@@ -46,3 +94,11 @@ field.value.test_field: ...@@ -46,3 +94,11 @@ field.value.test_field:
value: value:
type: label type: label
label: 'Value' label: 'Value'
entity_view_display.third_party.field_test:
type: mapping
label: 'Field test entity display third party setting'
mapping:
foo:
type: string
label: 'Test setting'
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
*/ */
class EntityDisplayTest extends KernelTestBase { class EntityDisplayTest extends KernelTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
public static $modules = array('field_ui', 'field', 'entity_test', 'user', 'text', 'field_test', 'node', 'system', 'entity_reference'); public static $modules = array('field_ui', 'field', 'entity_test', 'user', 'text', 'field_test', 'node', 'system', 'entity_reference');
protected function setUp() { protected function setUp() {
...@@ -48,7 +57,7 @@ public function testEntityDisplayCRUD() { ...@@ -48,7 +57,7 @@ public function testEntityDisplayCRUD() {
$this->assertEqual($display->getComponent('component_2'), $expected['component_2']); $this->assertEqual($display->getComponent('component_2'), $expected['component_2']);
// Check that arbitrary options are correctly stored. // Check that arbitrary options are correctly stored.
$expected['component_3'] = array('weight' => 10, 'foo' => 'bar'); $expected['component_3'] = array('weight' => 10, 'third_party_settings' => array('field_test' => array('foo' => 'bar')));
$display->setComponent('component_3', $expected['component_3']); $display->setComponent('component_3', $expected['component_3']);
$this->assertEqual($display->getComponent('component_3'), $expected['component_3']); $this->assertEqual($display->getComponent('component_3'), $expected['component_3']);
......
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
*/ */
class EntityFormDisplayTest extends KernelTestBase { class EntityFormDisplayTest extends KernelTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
public static $modules = array('field_ui', 'field', 'entity_test', 'field_test', 'user', 'text', 'entity_reference'); public static $modules = array('field_ui', 'field', 'entity_test', 'field_test', 'user', 'text', 'entity_reference');
protected function setUp() { protected function setUp() {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
namespace Drupal\field_ui\Tests; namespace Drupal\field_ui\Tests;
use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\Unicode;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageInterface;
use Drupal\simpletest\WebTestBase; use Drupal\simpletest\WebTestBase;
...@@ -20,7 +19,15 @@ ...@@ -20,7 +19,15 @@
*/ */
class ManageDisplayTest extends WebTestBase { class ManageDisplayTest extends WebTestBase {
use SchemaCheckTestTrait; /**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
use FieldUiTestTrait; use FieldUiTestTrait;
/** /**
...@@ -141,7 +148,6 @@ function testFormatterUI() { ...@@ -141,7 +148,6 @@ function testFormatterUI() {
$display = entity_load('entity_view_display', 'node.' . $this->type . '.default', TRUE); $display = entity_load('entity_view_display', 'node.' . $this->type . '.default', TRUE);
$this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'), 'foo'); $this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'), 'foo');
$this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()['module']), 'The display has a dependency on field_third_party_test module.'); $this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()['module']), 'The display has a dependency on field_third_party_test module.');
$this->assertConfigSchema(\Drupal::service('config.typed'), $display->getEntityType()->getConfigPrefix() . '.' . $display->id(), $display->toArray());
// Confirm that the third party settings are not updated on the settings form. // Confirm that the third party settings are not updated on the settings form.
$this->drupalPostAjaxForm(NULL, array(), "field_test_settings_edit"); $this->drupalPostAjaxForm(NULL, array(), "field_test_settings_edit");
...@@ -248,7 +254,6 @@ public function testWidgetUI() { ...@@ -248,7 +254,6 @@ public function testWidgetUI() {
$display = entity_load('entity_form_display', 'node.' . $this->type . '.default', TRUE); $display = entity_load('entity_form_display', 'node.' . $this->type . '.default', TRUE);
$this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo'); $this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo');
$this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()['module']), 'Form display does not have a dependency on field_third_party_test module.'); $this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()['module']), 'Form display does not have a dependency on field_third_party_test module.');
$this->assertConfigSchema(\Drupal::service('config.typed'), $display->getEntityType()->getConfigPrefix() . '.' . $display->id(), $display->toArray());
// Confirm that the third party settings are not updated on the settings form. // Confirm that the third party settings are not updated on the settings form.
$this->drupalPostAjaxForm(NULL, array(), "field_test_settings_edit"); $this->drupalPostAjaxForm(NULL, array(), "field_test_settings_edit");
......
...@@ -21,6 +21,15 @@ ...@@ -21,6 +21,15 @@
*/ */
class ManageFieldsTest extends WebTestBase { class ManageFieldsTest extends WebTestBase {
/**
* Set to TRUE to strict check all configuration saved.
*
* @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
*
* @var bool
*/
protected $strictConfigSchema = TRUE;
use FieldUiTestTrait; use FieldUiTestTrait;
/** /**
......
...@@ -21,18 +21,8 @@ field.formatter.settings.link: ...@@ -21,18 +21,8 @@ field.formatter.settings.link:
label: 'Open link in new window' label: 'Open link in new window'
field.formatter.settings.link_separate: field.formatter.settings.link_separate:
type: mapping type: field.formatter.settings.link
label: 'Link format settings' label: 'Link format settings'
mapping:
trim_length:
type: integer
label: 'Trim link text length'
rel:
type: string
label: 'Add rel="nofollow" to links'
target:
type: string
label: 'Open link in new window'
field.widget.settings.link_default: field.widget.settings.link_default:
type: mapping type: mapping
......
...@@ -33,7 +33,7 @@ class LinkSeparateFormatter extends LinkFormatter { ...@@ -33,7 +33,7 @@ class LinkSeparateFormatter extends LinkFormatter {
*/ */
public static function defaultSettings() { public static function defaultSettings() {
return array( return array(
'trim_length' => '80', 'trim_length' => 80,
'rel' => '', 'rel' => '',
'target' => '', 'target' => '',
) + parent::defaultSettings(); ) + parent::defaultSettings();
......
...@@ -20,6 +20,15 @@ ...@@ -20,6 +20,15 @@
*/ */
class LinkFieldTest extends WebTestBase { class LinkFieldTest 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.
* *
......
...@@ -62,7 +62,7 @@ public function getSettings($widget_type, $widget_settings) { ...@@ -62,7 +62,7 @@ public function getSettings($widget_type, $widget_settings) {
'placeholder' => '', 'placeholder' => '',
), ),
'link' => array( 'link' => array(
'placeholder_uri' => '', 'placeholder_url' => '',
'placeholder_title' => '', 'placeholder_title' => '',
), ),
'filefield_widget' => array( 'filefield_widget' => array(
......
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
*/ */
class MigrateFieldWidgetSettingsTest extends MigrateDrupalTestBase { class MigrateFieldWidgetSettingsTest extends MigrateDrupalTestBase {
/**
* 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 OptionsFloatFieldImportTest extends FieldTestBase { class OptionsFloatFieldImportTest extends FieldTestBase {