You are here

protected function NodeTranslationUITest::doTestTranslationEdit in Zircon Profile 8

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

Tests edit content translation.

Overrides ContentTranslationUITestBase::doTestTranslationEdit

File

core/modules/node/src/Tests/NodeTranslationUITest.php, line 430
Contains \Drupal\node\Tests\NodeTranslationUITest.

Class

NodeTranslationUITest
Tests the Node Translation UI.

Namespace

Drupal\node\Tests

Code

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);
      $title = t('<em>Edit @type</em> @title [%language translation]', array(
        '@type' => $type_name,
        '@title' => $entity
          ->getTranslation($langcode)
          ->label(),
        '%language' => $languages[$langcode]
          ->getName(),
      ));
      $this
        ->assertRaw($title);
    }
  }
}