You are here

protected function TaxonomyRelationshipTest::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Tests/Views/TaxonomyRelationshipTest.php \Drupal\taxonomy\Tests\Views\TaxonomyRelationshipTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides TaxonomyTestBase::setUp

File

core/modules/taxonomy/src/Tests/Views/TaxonomyRelationshipTest.php, line 38
Contains \Drupal\taxonomy\Tests\Views\TaxonomyRelationshipTest.

Class

TaxonomyRelationshipTest
Tests taxonomy relationships with parent term and node.

Namespace

Drupal\taxonomy\Tests\Views

Code

protected function setUp() {
  parent::setUp();

  // 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();
}