function TaxonomyFieldVidTest::setUp

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

Overrides ViewsKernelTestBase::setUp

File

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

Class

TaxonomyFieldVidTest
Tests the taxonomy term VID field handler.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) {
    parent::setUp($import_test_views);
    $this->installEntitySchema('taxonomy_term');
    $this->installEntitySchema('user');
    $this->installConfig([
        'filter',
    ]);
    
    /** @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary */
    $vocabulary = $this->createVocabulary();
    $this->term1 = $this->createTerm($vocabulary);
    // Create user 1 and set is as the logged in user, so that the logged in
    // user has the correct permissions to view the vocabulary name.
    $this->adminUser = User::create([
        'name' => $this->randomString(),
    ]);
    $this->adminUser
        ->save();
    $this->container
        ->get('current_user')
        ->setAccount($this->adminUser);
    ViewTestData::createTestViews(get_class($this), [
        'taxonomy_test_views',
    ]);
}

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