You are here

protected function CommentTranslationUITest::doTestTranslationEdit in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::doTestTranslationEdit()
  2. 10 core/modules/comment/tests/src/Functional/CommentTranslationUITest.php \Drupal\Tests\comment\Functional\CommentTranslationUITest::doTestTranslationEdit()

Tests edit content translation.

Overrides ContentTranslationUITestBase::doTestTranslationEdit

File

core/modules/comment/tests/src/Functional/CommentTranslationUITest.php, line 217

Class

CommentTranslationUITest
Tests the Comment Translation UI.

Namespace

Drupal\Tests\comment\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);
      $title = t('Edit @type @title [%language translation]', [
        '@type' => $this->entityTypeId,
        '@title' => $entity
          ->getTranslation($langcode)
          ->label(),
        '%language' => $languages[$langcode]
          ->getName(),
      ]);
      $this
        ->assertRaw($title);
    }
  }
}