You are here

protected function TaxonomyTestBase::setUp in Drupal 8

Same name in this branch
  1. 8 core/modules/taxonomy/src/Tests/TaxonomyTestBase.php \Drupal\taxonomy\Tests\TaxonomyTestBase::setUp()
  2. 8 core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase::setUp()
  3. 8 core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase::setUp()
  4. 8 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase::setUp()
Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase::setUp()
  2. 10 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase::setUp()

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewsKernelTestBase::setUp

2 calls to TaxonomyTestBase::setUp()
ArgumentValidatorTermTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/ArgumentValidatorTermTest.php
TaxonomyIndexTidFilterTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php
2 methods override TaxonomyTestBase::setUp()
ArgumentValidatorTermTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/ArgumentValidatorTermTest.php
TaxonomyIndexTidFilterTest::setUp in core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php

File

core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php, line 77

Class

TaxonomyTestBase
Base class for views kernel taxonomy tests.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);

  // Install node config to create body field.
  $this
    ->installEntitySchema('node');
  $this
    ->installConfig([
    'node',
    'filter',
  ]);
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('taxonomy_term');
  $this
    ->mockStandardInstall();
  if ($import_test_views) {
    ViewTestData::createTestViews(get_class($this), [
      'taxonomy_test_views',
    ]);
  }
  $this->term1 = $this
    ->createTerm();
  $this->term2 = $this
    ->createTerm();
  $node = [];
  $node['type'] = 'article';
  $node['field_views_testing_tags'][]['target_id'] = $this->term1
    ->id();
  $node['field_views_testing_tags'][]['target_id'] = $this->term2
    ->id();
  $this->nodes[] = $this
    ->drupalCreateNode($node);
  $this->nodes[] = $this
    ->drupalCreateNode($node);
}