You are here

protected function TermTranslationFieldViewTest::setUpNode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php \Drupal\taxonomy\Tests\TermTranslationFieldViewTest::setUpNode()

Creates a test subject node, with translation.

1 call to TermTranslationFieldViewTest::setUpNode()
TermTranslationFieldViewTest::setUp in core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php
Sets up a Drupal site for running functional and integration tests.

File

core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php, line 75
Contains \Drupal\taxonomy\Tests\TermTranslationFieldViewTest.

Class

TermTranslationFieldViewTest
Tests the translation of taxonomy terms field on nodes.

Namespace

Drupal\taxonomy\Tests

Code

protected function setUpNode() {

  /** @var \Drupal\node\Entity\Node $node */
  $node = entity_create('node', array(
    'title' => $this
      ->randomMachineName(),
    'type' => 'article',
    'description' => array(
      'value' => $this
        ->randomMachineName(),
      'format' => 'basic_html',
    ),
    $this->termFieldName => array(
      array(
        'target_id' => $this->term
          ->id(),
      ),
    ),
    'langcode' => $this->baseLangcode,
  ));
  $node
    ->save();
  $node
    ->addTranslation($this->translateToLangcode, $node
    ->toArray());
  $node
    ->save();
  $this->node = $node;
}