You are here

protected function TaxonomyIndexTidFilterTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyIndexTidFilterTest::setUp()
  2. 9 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyIndexTidFilterTest::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 TaxonomyTestBase::setUp

File

core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php, line 32

Class

TaxonomyIndexTidFilterTest
Test the taxonomy term index filter.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

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

  // Setup vocabulary and terms so the initial import is valid.
  Vocabulary::create([
    'vid' => 'tags',
    'name' => 'Tags',
  ])
    ->save();

  // This will get a term ID of 3.
  $term = Term::create([
    'vid' => 'tags',
    'name' => 'muh',
  ]);
  $term
    ->save();

  // This will get a term ID of 4.
  $this->terms[$term
    ->id()] = $term;
  $term = Term::create([
    'vid' => 'tags',
    'name' => 'muh',
  ]);
  $term
    ->save();
  $this->terms[$term
    ->id()] = $term;
  ViewTestData::createTestViews(static::class, [
    'taxonomy_test_views',
  ]);
}