You are here

protected function TermTranslationBreadcrumbTest::setUpTerms in Zircon Profile 8

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

Setup translated terms in a hierarchy.

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

File

core/modules/taxonomy/src/Tests/TermTranslationBreadcrumbTest.php, line 94
Contains \Drupal\taxonomy\Tests\TermTranslationBreadcrumbTest.

Class

TermTranslationBreadcrumbTest
Tests for proper breadcrumb translation.

Namespace

Drupal\taxonomy\Tests

Code

protected function setUpTerms() {
  $parent_vid = 0;
  foreach ($this->termTranslationMap as $name => $translation) {
    $term = $this
      ->createTerm($this->vocabulary, array(
      'name' => $name,
      'langcode' => $this->baseLangcode,
      'parent' => $parent_vid,
    ));
    $term
      ->addTranslation($this->translateToLangcode, array(
      'name' => $translation,
    ));
    $term
      ->save();

    // Each term is nested under the last.
    $parent_vid = $term
      ->id();
    $this->terms[] = $term;
  }
}