function TermIndexTest::testTaxonomyTermHierarchyBreadcrumbs

Tests that there is a link to the parent term on the child term page.

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php, line 213
Definition of Drupal\taxonomy\Tests\TermIndexTest.

Class

TermIndexTest
Tests the hook implementations that maintain the taxonomy index.

Namespace

Drupal\taxonomy\Tests

Code

function testTaxonomyTermHierarchyBreadcrumbs() {

  // Create two taxonomy terms and set term2 as the parent of term1.
  $term1 = $this
    ->createTerm($this->vocabulary);
  $term2 = $this
    ->createTerm($this->vocabulary);
  $term1->parent = array(
    $term2
      ->id(),
  );
  $term1
    ->save();

  // Verify that the page breadcrumbs include a link to the parent term.
  $this
    ->drupalGet('taxonomy/term/' . $term1
    ->id());
  $this
    ->assertRaw(l($term2
    ->label(), 'taxonomy/term/' . $term2
    ->id()), 'Parent term link is displayed when viewing the node.');
}