function TaxonomyFieldVidTest::setUp

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

File

core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyFieldVidTest.php, line 59

Class

TaxonomyFieldVidTest
Tests the taxonomy term VID field handler.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) : void {
    parent::setUp($import_test_views);
    $this->installEntitySchema('taxonomy_term');
    $this->installEntitySchema('user');
    $this->installConfig([
        'filter',
    ]);
    
    /** @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary */
    $vocabulary = $this->createVocabulary([
        'vid' => 'aaa',
    ]);
    $term = $this->createTerm($vocabulary);
    $this->terms[$term->id()] = $term;
    
    /** @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary2 */
    $vocabulary2 = $this->createVocabulary([
        'vid' => 'bbb',
    ]);
    $term = $this->createTerm($vocabulary2);
    $this->terms[$term->id()] = $term;
    $this->adminUser = $this->createUser([
        'administer taxonomy',
    ]);
    $this->container
        ->get('current_user')
        ->setAccount($this->adminUser);
    ViewTestData::createTestViews(static::class, [
        'taxonomy_test_views',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.