Skip to content
Snippets Groups Projects
Verified Commit ad25f53a authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3362453 by NickDickinsonWilde, Wim Leers, tim.plunkett, borisson_: Fix...

Issue #3362453 by NickDickinsonWilde, Wim Leers, tim.plunkett, borisson_: Fix all ConfigExists constraint violations in tests
parent 243be9a2
No related branches found
No related tags found
43 merge requests!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4594Applying patch for Views Global Text area field to allow extra HTML tags. As video, source and iframe tag is not rendering. Due to which Media embedded video and remote-video not rendering in Views Global Text area field.,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3451Issue #2410579: Allows setting the current language programmatically.,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!31312878513-10.1.x,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
...@@ -62,9 +62,6 @@ public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $co ...@@ -62,9 +62,6 @@ public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $co
// in the config schema tree to have validation constraints defined. // in the config schema tree to have validation constraints defined.
$violations = $this->schema->validate(); $violations = $this->schema->validate();
$ignored_validation_constraint_messages = [ $ignored_validation_constraint_messages = [
// @see \Drupal\Core\Config\Plugin\Validation\Constraint\ConfigExistsConstraint::$message
// @todo Remove this in https://www.drupal.org/project/drupal/issues/3362453
"The '.*' config does not exist.",
// @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$moduleMessage // @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$moduleMessage
// @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$themeMessage // @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$themeMessage
// @todo Remove this in https://www.drupal.org/project/drupal/issues/3362456 // @todo Remove this in https://www.drupal.org/project/drupal/issues/3362456
......
...@@ -61,7 +61,7 @@ protected function setUp(): void { ...@@ -61,7 +61,7 @@ protected function setUp(): void {
$this->installEntitySchema('user'); $this->installEntitySchema('user');
// Set default storage backend and configure the theme system. // Set default storage backend and configure the theme system.
$this->installConfig(['field', 'system']); $this->installConfig(['field', 'system', 'user']);
// Create user 1. // Create user 1.
$storage = \Drupal::entityTypeManager()->getStorage('user'); $storage = \Drupal::entityTypeManager()->getStorage('user');
......
...@@ -25,8 +25,9 @@ class EntityFormDisplayTest extends KernelTestBase { ...@@ -25,8 +25,9 @@ class EntityFormDisplayTest extends KernelTestBase {
'field', 'field',
'entity_test', 'entity_test',
'field_test', 'field_test',
'user', 'system',
'text', 'text',
'user',
]; ];
/** /**
...@@ -34,6 +35,8 @@ class EntityFormDisplayTest extends KernelTestBase { ...@@ -34,6 +35,8 @@ class EntityFormDisplayTest extends KernelTestBase {
*/ */
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->installEntitySchema('action');
$this->installConfig('user');
$this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test');
} }
......
...@@ -122,7 +122,6 @@ protected function setSections(array $sections) { ...@@ -122,7 +122,6 @@ protected function setSections(array $sections) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function preSave(EntityStorageInterface $storage) { public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
$original_value = isset($this->original) ? $this->original->isOverridable() : FALSE; $original_value = isset($this->original) ? $this->original->isOverridable() : FALSE;
$new_value = $this->isOverridable(); $new_value = $this->isOverridable();
...@@ -138,6 +137,8 @@ public function preSave(EntityStorageInterface $storage) { ...@@ -138,6 +137,8 @@ public function preSave(EntityStorageInterface $storage) {
} }
} }
parent::preSave($storage);
$already_enabled = isset($this->original) ? $this->original->isLayoutBuilderEnabled() : FALSE; $already_enabled = isset($this->original) ? $this->original->isLayoutBuilderEnabled() : FALSE;
$set_enabled = $this->isLayoutBuilderEnabled(); $set_enabled = $this->isLayoutBuilderEnabled();
if ($already_enabled !== $set_enabled) { if ($already_enabled !== $set_enabled) {
......
...@@ -34,6 +34,7 @@ protected function setUp(): void { ...@@ -34,6 +34,7 @@ protected function setUp(): void {
$this->actionManager = $this->container->get('plugin.manager.action'); $this->actionManager = $this->container->get('plugin.manager.action');
$this->installEntitySchema('user'); $this->installEntitySchema('user');
$this->installConfig('user');
} }
/** /**
......
...@@ -69,6 +69,7 @@ public function testCalculateDependencies() { ...@@ -69,6 +69,7 @@ public function testCalculateDependencies() {
'format' => 'test_format', 'format' => 'test_format',
'name' => 'Test format', 'name' => 'Test format',
]); ]);
$format->save();
$fieldName = mb_strtolower($this->randomMachineName()); $fieldName = mb_strtolower($this->randomMachineName());
$field_storage = FieldStorageConfig::create([ $field_storage = FieldStorageConfig::create([
'field_name' => $fieldName, 'field_name' => $fieldName,
......
...@@ -2,11 +2,17 @@ ...@@ -2,11 +2,17 @@
namespace Drupal\Tests\views\Kernel; namespace Drupal\Tests\views\Kernel;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\node\Entity\NodeType;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\SchemaCheckTestTrait; use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\config_test\TestInstallStorage; use Drupal\config_test\TestInstallStorage;
use Drupal\Core\Config\InstallStorage; use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\TypedConfigManager; use Drupal\Core\Config\TypedConfigManager;
use Drupal\KernelTests\KernelTestBase; use Drupal\KernelTests\KernelTestBase;
use Drupal\views\Tests\ViewTestData;
/** /**
* Tests that test views provided by all modules match schema. * Tests that test views provided by all modules match schema.
...@@ -22,7 +28,122 @@ class TestViewsTest extends KernelTestBase { ...@@ -22,7 +28,122 @@ class TestViewsTest extends KernelTestBase {
* *
* @var array * @var array
*/ */
protected static $modules = ['views_test_data']; protected static $modules = [
// `node.type.book` config entity is a config dependency.
// @see core/modules/book/tests/modules/book_test_views/test_views/views.view.test_book_view.yml
'book',
// For NodeType config entities to exist, its module must be installed.
// @see book_entity_type_build()
'node',
// The `DRUPAL_OPTIONAL` constant is used by the NodeType config entity type
// and only available if the system module is installed.
// `system.menu.tools` is a config dependency. It is one of the default
// config of the System module.
// @see \DRUPAL_OPTIONAL
// @see \Drupal\node\Entity\NodeType::$preview_mode
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml
'system',
// There are a number of `field.storage.*.*` config dependencies. For these
// to be created, the Field module must be installed.
'field',
// Some of the `field.storage.*.*` config dependencies use the `link` field
// type. For fields of this type to be created the module must be installed.
// @see core/modules/link/tests/modules/link_test_views/test_views/views.view.test_link_tokens.yml
// @see \Drupal\Tests\link\Functional\Views\LinkViewsTokensTest
'link',
// `field.storage.node.body` config entity is a config dependency. It is one
// of the default config of the Node module. And it requires the
// `text_with_summary` field type, which is provided by the Text module.
// @see core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_tokens.yml
'text',
// For Vocabulary config entities to exist, its module must be installed.
'taxonomy',
// `user.role.authenticated` is a config dependency. It is one of the
// default config of the User module.
'user',
// `field.storage.entity_test.field_test` is a config dependency. It uses
// the `entity_type` content entity type, which is provided by the
// entity_test module.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_attachment_test.yml
// @see \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::setUp()
'entity_test',
'views_test_data',
];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
// `node.type.book` config entity is a config dependency.
// @see core/modules/book/tests/modules/book_test_views/test_views/views.view.test_book_view.yml
$this->installConfig('book');
// `field.storage.node.body` config entity is a config dependency. It is one
// of the default config of the Node module.
// @see core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_tokens.yml
$this->installConfig('node');
// `user.role.authenticated` is a config dependency. It is one of the
// default config of the User module.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_icon.yml
$this->installConfig('user');
// `system.menu.tools` is a config dependency. It is one of the default
// config of the System module.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_row_render_cache_none.yml
$this->installConfig('system');
// `node.type.article` is a config dependency.
// @see core/modules/options/tests/options_test_views/test_views/views.view.test_options_list_argument_numeric.yml
NodeType::create(['type' => 'article'])->save();
// `node.type.page` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_default_node.yml
NodeType::create(['type' => 'page'])->save();
// `taxonomy.vocabulary.tags` is a config dependency.
// @see core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_taxonomy_exposed_grouped_filter.yml
Vocabulary::create(['vid' => 'tags'])->save();
// `taxonomy.vocabulary.test_exposed_checkboxes` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_form_checkboxes.yml
Vocabulary::create(['vid' => 'test_exposed_checkboxes'])->save();
// `core.entity_view_mode.node.default` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_field_renderered_entity.yml
EntityViewMode::create([
'id' => 'node.default',
'targetEntityType' => 'node',
])->save();
// `field.storage.node.field_link` is a config dependency.
// @see core/modules/link/tests/modules/link_test_views/test_views/views.view.test_link_tokens.yml
// @see \Drupal\Tests\link\Functional\Views\LinkViewsTokensTest
FieldStorageConfig::create([
'field_name' => 'field_link',
'type' => 'link',
'entity_type' => 'node',
'cardinality' => 1,
])->save();
// `field.storage.node.field_test` is a config dependency.
// @see core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_field_delete.yml
// @see \Drupal\Tests\field_ui\Functional\FieldUIDeleteTest::testDeleteField()
FieldStorageConfig::create([
'field_name' => 'field_test',
'type' => 'integer',
'entity_type' => 'node',
])->save();
// `field.storage.entity_test.field_test` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_field_field_attachment_test.yml
// @see \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::setUp()
FieldStorageConfig::create([
'field_name' => 'field_test',
'entity_type' => 'entity_test',
'type' => 'integer',
])->save();
// `views.view.test_group_rows` is a config dependency.
// @see core/modules/views/tests/modules/views_test_config/test_views/views.view.test_group_rows.yml
// @see \Drupal\Tests\views\Functional\Handler\FieldGroupRowsWebTest::setUp()
FieldStorageConfig::create([
'field_name' => 'field_views_testing_group_rows',
'entity_type' => 'node',
'type' => 'text',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
])->save();
ViewTestData::createTestViews(self::class, ['views_test_data']);
}
/** /**
* Tests default configuration data type. * Tests default configuration data type.
...@@ -38,6 +159,8 @@ public function testDefaultConfig() { ...@@ -38,6 +159,8 @@ public function testDefaultConfig() {
\Drupal::service('class_resolver') \Drupal::service('class_resolver')
); );
$typed_config->setValidationConstraintManager(\Drupal::service('validation.constraint')); $typed_config->setValidationConstraintManager(\Drupal::service('validation.constraint'));
// Avoid restricting to the config schemas discovered.
$this->container->get('cache.discovery')->delete('typed_config_definitions');
// Create a configuration storage with access to default configuration in // Create a configuration storage with access to default configuration in
// every module, profile and theme. // every module, profile and theme.
......
...@@ -84,13 +84,14 @@ public function testConfigurableFieldStorageSettings() { ...@@ -84,13 +84,14 @@ public function testConfigurableFieldStorageSettings() {
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'test_field', 'type' => 'test_field',
]); ]);
$field_storage->save();
// Check that the default settings have been populated. // Check that the default settings have been populated.
$expected_settings = [ $expected_settings = [
'test_field_storage_setting' => 'dummy test string', 'test_field_storage_setting' => 'dummy test string',
'changeable' => 'a changeable field storage setting', 'changeable' => 'a changeable field storage setting',
'unchangeable' => 'an unchangeable field storage setting', 'unchangeable' => 'an unchangeable field storage setting',
'translatable_storage_setting' => 'a translatable field storage setting', 'translatable_storage_setting' => 'a translatable field storage setting',
'storage_setting_from_config_data' => 'TRUE',
]; ];
$this->assertEquals($expected_settings, $field_storage->getSettings()); $this->assertEquals($expected_settings, $field_storage->getSettings());
...@@ -111,6 +112,7 @@ public function testConfigurableFieldSettings() { ...@@ -111,6 +112,7 @@ public function testConfigurableFieldSettings() {
'entity_type' => 'entity_test', 'entity_type' => 'entity_test',
'type' => 'test_field', 'type' => 'test_field',
]); ]);
$field_storage->save();
$field = FieldConfig::create([ $field = FieldConfig::create([
'field_storage' => $field_storage, 'field_storage' => $field_storage,
'bundle' => 'entity_test', 'bundle' => 'entity_test',
...@@ -130,6 +132,7 @@ public function testConfigurableFieldSettings() { ...@@ -130,6 +132,7 @@ public function testConfigurableFieldSettings() {
'test_field_setting' => 'dummy test string', 'test_field_setting' => 'dummy test string',
'translatable_field_setting' => 'a translatable field setting', 'translatable_field_setting' => 'a translatable field setting',
'field_setting_from_config_data' => 'TRUE', 'field_setting_from_config_data' => 'TRUE',
'storage_setting_from_config_data' => 'TRUE',
]; ];
$this->assertEquals($expected_settings, $field->getSettings()); $this->assertEquals($expected_settings, $field->getSettings());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment