function TermTranslationFieldViewTest::setUpNode
Creates a test subject node, with translation.
1 call to TermTranslationFieldViewTest::setUpNode()
- TermTranslationFieldViewTest::setUp in core/modules/ taxonomy/ tests/ src/ Functional/ TermTranslationFieldViewTest.php 
File
- 
              core/modules/ taxonomy/ tests/ src/ Functional/ TermTranslationFieldViewTest.php, line 80 
Class
- TermTranslationFieldViewTest
- Tests the translation of taxonomy terms field on nodes.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
protected function setUpNode() {
  /** @var \Drupal\node\Entity\Node $node */
  $node = Node::create([
    'title' => $this->randomMachineName(),
    'type' => 'article',
    'description' => [
      [
        'value' => $this->randomMachineName(),
        'format' => 'basic_html',
      ],
    ],
    $this->termFieldName => [
      [
        'target_id' => $this->term
          ->id(),
      ],
    ],
    'langcode' => $this->baseLangcode,
  ]);
  $node->save();
  $node->addTranslation($this->translateToLangcode, $node->toArray());
  $node->save();
  $this->node = $node;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
