function ContentTranslationUITestBase::doTestTranslationEdit

Same name in other branches
  1. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::doTestTranslationEdit()
  2. 8.9.x core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php \Drupal\content_translation\Tests\ContentTranslationUITestBase::doTestTranslationEdit()
  3. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::doTestTranslationEdit()
  4. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::doTestTranslationEdit()

Tests edit content translation.

1 call to ContentTranslationUITestBase::doTestTranslationEdit()
ContentTranslationUITestBase::testTranslationUI in core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php
Tests the basic translation UI.
7 methods override ContentTranslationUITestBase::doTestTranslationEdit()
BlockContentTranslationUITest::doTestTranslationEdit in core/modules/block_content/tests/src/Functional/BlockContentTranslationUITest.php
Tests edit content translation.
CommentTranslationUITest::doTestTranslationEdit in core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
Tests edit content translation.
MenuLinkContentTranslationUITest::doTestTranslationEdit in core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php
Tests edit content translation.
NodeTranslationUITest::doTestTranslationEdit in core/modules/node/tests/src/Functional/NodeTranslationUITest.php
Tests edit content translation.
ShortcutTranslationUITest::doTestTranslationEdit in core/modules/shortcut/tests/src/Functional/ShortcutTranslationUITest.php
Tests edit content translation.

... See full list

File

core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php, line 514

Class

ContentTranslationUITestBase
Tests the Content Translation UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

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()
                ->responseContains($entity->getTranslation($langcode)
                ->label());
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.