You are here

protected function TermTranslationFieldViewTest::setUpTerm in Drupal 9

Same name and namespace in other branches
  1. 8 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();
}