diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php index 41bcf95..4fbbb81 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php @@ -41,6 +41,7 @@ function testTranslationUI() { $this->doTestOutdatedStatus(); $this->doTestPublishedStatus(); $this->doTestAuthoringInfo(); + $this->doTestTranslationEdit(); $this->doTestTranslationDeletion(); } diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php index d16d13a..2047661 100644 --- a/core/modules/node/src/Tests/NodeTranslationUITest.php +++ b/core/modules/node/src/Tests/NodeTranslationUITest.php @@ -12,6 +12,7 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; use Drupal\node\Entity\Node; +use Drupal\Component\Utility\String; /** * Tests the Node Translation UI. @@ -373,4 +374,43 @@ protected function doUninstallTest() { $this->assertEqual($language_count, count(\Drupal::configFactory()->listAll('language.content_settings.')), 'Languages have been fixed rather than deleted during content_translation uninstall.'); } + /** + * Tests edit content translation. + */ + protected function doTestTranslationEdit() { + $entity = entity_load($this->entityTypeId, $this->entityId, TRUE); + $languages = $this->container->get('language_manager')->getLanguages(); + $type_name = node_get_type_label($entity); + + foreach ($this->langcodes as $langcode) { + // We only want to test the title for non-english translations. + if ($langcode != 'en') { + $options = array('language' => $languages[$langcode]); + $url = $entity->urlInfo('edit-form', $options); + $this->drupalGet($url); + $this->assertResponse(200, 'Translate edit page is alright'); + + $title = String::format('%edit @title', array( + '%edit' => t('Edit @type', array('@type' => $type_name)), + '@title' => $entity->getTranslation($langcode)->label(), + )); + $title = t('!title [%language translation]', array( + '!title' => $title, + '%language' => $languages[$langcode]->getName(), + )); + $this->assertRaw($title); + + $title = t('Edit @type @title', array( + '@type' => $type_name, + '@title' => $entity->getTranslation($langcode)->label(), + )); + $title = t('!title [%language translation]', array( + '!title' => $title, + '%language' => $languages[$langcode]->getName(), + )); + $this->assertNoRaw(String::checkPlain($title)); + } + } + } + }