function TermTranslationFieldViewTest::setUpTerm

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php \Drupal\Tests\taxonomy\Functional\TermTranslationFieldViewTest::setUpTerm()
  2. 10 core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php \Drupal\Tests\taxonomy\Functional\TermTranslationFieldViewTest::setUpTerm()
  3. 11.x core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php \Drupal\Tests\taxonomy\Functional\TermTranslationFieldViewTest::setUpTerm()

Creates a test subject term, with translation.

1 call to TermTranslationFieldViewTest::setUpTerm()
TermTranslationFieldViewTest::setUp in core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php

File

core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php, line 100

Class

TermTranslationFieldViewTest
Tests the translation of taxonomy terms field on nodes.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function setUpTerm() {
    $this->term = $this->createTerm($this->vocabulary, [
        'name' => $this->baseTagName,
        'langcode' => $this->baseLangcode,
    ]);
    $this->term
        ->addTranslation($this->translateToLangcode, [
        'name' => $this->translatedTagName,
    ]);
    $this->term
        ->save();
}

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