function TaxonomyRelationshipTest::setUp
Overrides TaxonomyTestBase::setUp
File
- 
              core/modules/ taxonomy/ tests/ src/ Functional/ Views/ TaxonomyRelationshipTest.php, line 38 
Class
- TaxonomyRelationshipTest
- Tests taxonomy relationships with parent term and node.
Namespace
Drupal\Tests\taxonomy\Functional\ViewsCode
protected function setUp($import_test_views = TRUE, $modules = []) : void {
  parent::setUp($import_test_views, $modules);
  // Make term2 parent of term1.
  $this->term1
    ->set('parent', $this->term2
    ->id());
  $this->term1
    ->save();
  // Store terms in an array for testing.
  $this->terms[] = $this->term1;
  $this->terms[] = $this->term2;
  // Only set term1 on node1 and term2 on node2 for testing.
  unset($this->nodes[0]->field_views_testing_tags[1]);
  $this->nodes[0]
    ->save();
  unset($this->nodes[1]->field_views_testing_tags[0]);
  $this->nodes[1]
    ->save();
  Views::viewsData()->clear();
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
