You are here

protected function BlockContentTranslationUITest::doTestTranslationEdit in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Tests/BlockContentTranslationUITest.php \Drupal\block_content\Tests\BlockContentTranslationUITest::doTestTranslationEdit()

Tests edit content translation.

Overrides ContentTranslationUITestBase::doTestTranslationEdit

File

core/modules/block_content/src/Tests/BlockContentTranslationUITest.php, line 184
Contains \Drupal\block_content\Tests\BlockContentTranslationUITest.

Class

BlockContentTranslationUITest
Tests the block content translation UI.

Namespace

Drupal\block_content\Tests

Code

protected function doTestTranslationEdit() {
  $entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
  $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 = array(
        'language' => $languages[$langcode],
      );
      $url = $entity
        ->urlInfo('edit-form', $options);
      $this
        ->drupalGet($url);
      $title = t('<em>Edit @type</em> @title [%language translation]', array(
        '@type' => $entity
          ->bundle(),
        '@title' => $entity
          ->getTranslation($langcode)
          ->label(),
        '%language' => $languages[$langcode]
          ->getName(),
      ));
      $this
        ->assertRaw($title);
    }
  }
}