protected function ShortcutTranslationUITest::doTestTranslationEdit in Drupal 9
Same name and namespace in other branches
- 8 core/modules/shortcut/tests/src/Functional/ShortcutTranslationUITest.php \Drupal\Tests\shortcut\Functional\ShortcutTranslationUITest::doTestTranslationEdit()
Tests edit content translation.
Overrides ContentTranslationUITestBase::doTestTranslationEdit
File
- core/
modules/ shortcut/ tests/ src/ Functional/ ShortcutTranslationUITest.php, line 94
Class
- ShortcutTranslationUITest
- Tests the shortcut translation UI.
Namespace
Drupal\Tests\shortcut\FunctionalCode
protected function doTestTranslationEdit() {
$storage = $this->container
->get('entity_type.manager')
->getStorage($this->entityTypeId);
$storage
->resetCache([
$this->entityId,
]);
$entity = $storage
->load($this->entityId);
$languages = $this->container
->get('language_manager')
->getLanguages();
foreach ($this->langcodes as $langcode) {
// We only want to test the title for non-english translations.
if ($langcode != 'en') {
$options = [
'language' => $languages[$langcode],
];
$url = $entity
->toUrl('edit-form', $options);
$this
->drupalGet($url);
$this
->assertSession()
->pageTextContains("{$entity->getTranslation($langcode)->label()} [{$languages[$langcode]->getName()} translation]");
}
}
}