function TaxonomyTestBase::setUp

Same name in this branch
  1. 10 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase::setUp()
  2. 10 core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\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. 9 core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase::setUp()
  3. 9 core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase::setUp()
  4. 8.9.x core/modules/taxonomy/src/Tests/TaxonomyTestBase.php \Drupal\taxonomy\Tests\TaxonomyTestBase::setUp()
  5. 8.9.x core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase::setUp()
  6. 8.9.x core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase::setUp()
  7. 8.9.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase::setUp()
  8. 11.x core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyTestBase::setUp()
  9. 11.x core/modules/taxonomy/tests/src/Functional/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase::setUp()
  10. 11.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php \Drupal\Tests\taxonomy\Functional\Views\TaxonomyTestBase::setUp()

Sets up the test.

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.

array $modules: The module directories to look in for test views.

Overrides ViewTestBase::setUp

6 calls to TaxonomyTestBase::setUp()
EntityArgumentTest::setUp in core/modules/views/tests/src/Functional/Plugin/EntityArgumentTest.php
Sets up the test.
TaxonomyRelationshipTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php
Sets up the test.
TaxonomyTermArgumentDepthTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php
Sets up the test.
TaxonomyTermViewTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
Sets up the test.
TaxonomyVocabularyArgumentTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php
Sets up the test.

... See full list

6 methods override TaxonomyTestBase::setUp()
EntityArgumentTest::setUp in core/modules/views/tests/src/Functional/Plugin/EntityArgumentTest.php
Sets up the test.
TaxonomyRelationshipTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php
Sets up the test.
TaxonomyTermArgumentDepthTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php
Sets up the test.
TaxonomyTermViewTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
Sets up the test.
TaxonomyVocabularyArgumentTest::setUp in core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php
Sets up the test.

... See full list

File

core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTestBase.php, line 58

Class

TaxonomyTestBase
Base class for all taxonomy tests.

Namespace

Drupal\Tests\taxonomy\Functional\Views

Code

protected function setUp($import_test_views = TRUE, $modules = []) : void {
    // Important: taxonomy_test_views module must not be in the $modules to
    // avoid an issue that particular view is already exists.
    parent::setUp($import_test_views, $modules);
    $this->mockStandardInstall();
    // This needs to be done again after ::mockStandardInstall() to make
    // test vocabularies available.
    // Explicitly add taxonomy_test_views to $modules now, so required views are
    // being created.
    $modules[] = 'taxonomy_test_views';
    if ($import_test_views) {
        ViewTestData::createTestViews(static::class, $modules);
    }
    $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);
}

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