protected function TaxonomyFieldVidTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 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 58
Class
- TaxonomyFieldVidTest
- Tests the taxonomy term VID field handler.
Namespace
Drupal\Tests\taxonomy\Kernel\ViewsCode
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();
$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(static::class, [
'taxonomy_test_views',
]);
}