diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index 81de3aa..d831045 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -173,27 +173,31 @@ protected function enableTranslation() { * Creates the test fields. */ protected function setupTestFields() { - $this->fieldName = 'field_test_et_ui_test'; - - entity_create('field_storage_config', array( - 'name' => $this->fieldName, - 'type' => 'text', - 'entity_type' => $this->entityTypeId, - 'cardinality' => 1, - 'translatable' => TRUE, - ))->save(); - entity_create('field_instance_config', array( - 'entity_type' => $this->entityTypeId, - 'field_name' => $this->fieldName, - 'bundle' => $this->bundle, - 'label' => 'Test translatable text-field', - ))->save(); - entity_get_form_display($this->entityTypeId, $this->bundle, 'default') - ->setComponent($this->fieldName, array( - 'type' => 'text_textfield', - 'weight' => 0, - )) - ->save(); + $entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId); + if ($entity_type->isFieldable()) { + if (empty($this->fieldName)) { + $this->fieldName = 'field_test_et_ui_test'; + } + entity_create('field_storage_config', array( + 'name' => $this->fieldName, + 'type' => 'text', + 'entity_type' => $this->entityTypeId, + 'cardinality' => 1, + 'translatable' => TRUE, + ))->save(); + entity_create('field_instance_config', array( + 'entity_type' => $this->entityTypeId, + 'field_name' => $this->fieldName, + 'bundle' => $this->bundle, + 'label' => 'Test translatable text-field', + ))->save(); + entity_get_form_display($this->entityTypeId, $this->bundle, 'default') + ->setComponent($this->fieldName, array( + 'type' => 'text_textfield', + 'weight' => 0, + )) + ->save(); + } } /** diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php b/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php index 8d2c1f7..3a3e027 100644 --- a/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php +++ b/core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php @@ -34,7 +34,6 @@ class MenuLinkContentUITest extends ContentTranslationUITest { protected function setUp() { $this->entityTypeId = 'menu_link_content'; $this->bundle = 'menu_link_content'; - $this->fieldName = 'title'; parent::setUp(); } diff --git a/core/modules/shortcut/src/Entity/ShortcutSet.php b/core/modules/shortcut/src/Entity/ShortcutSet.php index 5957961..9d4c925 100644 --- a/core/modules/shortcut/src/Entity/ShortcutSet.php +++ b/core/modules/shortcut/src/Entity/ShortcutSet.php @@ -30,6 +30,7 @@ * } * }, * config_prefix = "set", + * bundle_of = "shortcut", * entity_keys = { * "id" = "id", * "label" = "label" diff --git a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php new file mode 100644 index 0000000..116aae6 --- /dev/null +++ b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php @@ -0,0 +1,56 @@ +entityTypeId = 'shortcut'; + $this->bundle = 'default'; + $this->fieldName = 'title'; + parent::setUp(); + } + + /** + * {@inheritdoc} + */ + protected function getTranslatorPermissions() { + return array_merge(parent::getTranslatorPermissions(), array('administer shortcuts')); + } + + /** + * {@inheritdoc} + */ + protected function createEntity($values, $langcode, $bundle_name = NULL) { + $values['route_name'] = 'system.admin'; + $values['title'] = 'Administration'; + return parent::createEntity($values, $langcode, $bundle_name); + } + +}