diff -u b/core/modules/language/tests/src/Kernel/LanguageDisplayConfigurationAfterUninstallTest.php b/core/modules/language/tests/src/Kernel/LanguageDisplayConfigurationAfterUninstallTest.php --- b/core/modules/language/tests/src/Kernel/LanguageDisplayConfigurationAfterUninstallTest.php +++ b/core/modules/language/tests/src/Kernel/LanguageDisplayConfigurationAfterUninstallTest.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\language\Kernel; +use Drupal\Core\Entity\Entity\EntityFormDisplay; +use Drupal\Core\Entity\Entity\EntityFormMode; use Drupal\KernelTests\KernelTestBase; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityViewMode; @@ -33,9 +35,27 @@ // For uninstall to work. $this->installSchema('user', ['users_data']); - // Create default display. + // Create 'default' view-display. + $display = EntityViewDisplay::create([ + 'targetEntityType' => 'entity_test', + 'bundle' => 'entity_test', + 'mode' => 'default', + 'status' => TRUE, + ]); + $display->save(); + + // Create 'default' form-display. + $display = EntityFormDisplay::create([ + 'targetEntityType' => 'entity_test', + 'bundle' => 'entity_test', + 'mode' => 'default', + 'status' => TRUE, + ]); + $display->save(); + + // Create a view-mode 'manual', create view-display that uses it. EntityViewMode::create([ - 'id' => 'entity_test.default', + 'id' => 'entity_test.manual', 'targetEntityType' => 'entity_test', 'status' => TRUE, 'enabled' => TRUE, @@ -43,7 +63,22 @@ $display = EntityViewDisplay::create([ 'targetEntityType' => 'entity_test', 'bundle' => 'entity_test', - 'mode' => 'default', + 'mode' => 'manual', + 'status' => TRUE, + ]); + $display->save(); + + // Create a new form-mode 'manual', create form-display that uses it. + EntityFormMode::create([ + 'id' => 'entity_test.manual', + 'targetEntityType' => 'entity_test', + 'status' => TRUE, + 'enabled' => TRUE, + ])->save(); + $display = EntityFormDisplay::create([ + 'targetEntityType' => 'entity_test', + 'bundle' => 'entity_test', + 'mode' => 'manual', 'status' => TRUE, ]); $display->save(); @@ -51,19 +86,28 @@ } /** - * Tests the widget with the locked languages. + * Tests display configuration after uninstalling Language module. */ public function testConfigAfterUninstall() { - $default_config_name = 'core.entity_view_display.entity_test.entity_test.default'; + $default_view_display = 'core.entity_view_display.entity_test.entity_test.default'; + $default_form_display = 'core.entity_view_display.entity_test.entity_test.default'; + $manual_view_display = 'core.entity_view_display.entity_test.entity_test.manual'; + $manual_form_display = 'core.entity_view_display.entity_test.entity_test.manual'; // 1. Validate that "langcode" key is there. - $this->assertArrayHasKey('langcode', \Drupal::config($default_config_name)->get('hidden')); + $this->assertArrayHasKey('langcode', \Drupal::config($default_view_display)->get('hidden')); + $this->assertArrayHasKey('langcode', \Drupal::config($default_form_display)->get('hidden')); + $this->assertArrayHasKey('langcode', \Drupal::config($manual_view_display)->get('hidden')); + $this->assertArrayHasKey('langcode', \Drupal::config($manual_form_display)->get('hidden')); // 2. Uninstall language module. \Drupal::service('module_installer')->uninstall(['language']); // 3. Test that "langcode" key is removed from field config. - $this->assertArrayNotHasKey('langcode', \Drupal::config($default_config_name)->get('hidden')); + $this->assertArrayNotHasKey('langcode', \Drupal::config($default_view_display)->get('hidden')); + $this->assertArrayNotHasKey('langcode', \Drupal::config($default_form_display)->get('hidden')); + $this->assertArrayNotHasKey('langcode', \Drupal::config($manual_view_display)->get('hidden')); + $this->assertArrayNotHasKey('langcode', \Drupal::config($manual_form_display)->get('hidden')); }