function TaxonomyRelationshipTest::setUp

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyRelationshipTest::setUp()
  2. 8.9.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyRelationshipTest::setUp()
  3. 11.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyRelationshipTest::setUp()

Overrides TaxonomyTestBase::setUp

File

core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php, line 40

Class

TaxonomyRelationshipTest
Tests taxonomy relationships with parent term and node.

Namespace

Drupal\Tests\taxonomy\Functional\Views

Code

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.