You are here

public function TermTranslationTest::testTermsTranslation in Drupal 8

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

Test translation of terms are showed in the node.

File

core/modules/taxonomy/tests/src/Functional/TermTranslationTest.php, line 95

Class

TermTranslationTest
Tests for proper breadcrumb translation.

Namespace

Drupal\Tests\taxonomy\Functional

Code

public function testTermsTranslation() {

  // Set the display of the term reference field on the article content type
  // to "Check boxes/radio buttons".
  \Drupal::service('entity_display.repository')
    ->getFormDisplay('node', 'article')
    ->setComponent($this->termFieldName, [
    'type' => 'options_buttons',
  ])
    ->save();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'create article content',
  ]));

  // Test terms are listed.
  $this
    ->drupalget('node/add/article');
  $this
    ->assertText('one');
  $this
    ->assertText('two');
  $this
    ->assertText('three');

  // Test terms translated are listed.
  $this
    ->drupalget('hu/node/add/article');
  $this
    ->assertText('translatedOne');
  $this
    ->assertText('translatedTwo');
  $this
    ->assertText('translatedThree');
}