function ExposedFormCheckboxesTest::setUp

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormCheckboxesTest::setUp()
  2. 10 core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormCheckboxesTest::setUp()
  3. 11.x core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php \Drupal\Tests\views\Functional\Plugin\ExposedFormCheckboxesTest::setUp()

Overrides ViewTestBase::setUp

File

core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php, line 54

Class

ExposedFormCheckboxesTest
Tests exposed forms functionality.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

protected function setUp($import_test_views = TRUE) {
    parent::setUp(FALSE);
    // Create a vocabulary and entity reference field so we can test the "is all
    // of" filter operator. Must be done ahead of the view import so the
    // vocabulary is in place to meet the view dependencies.
    $vocabulary = Vocabulary::create([
        'name' => 'test_exposed_checkboxes',
        'vid' => 'test_exposed_checkboxes',
        'nodes' => [
            'article' => 'article',
        ],
    ]);
    $vocabulary->save();
    $this->vocabulary = $vocabulary;
    ViewTestData::createTestViews(self::class, [
        'views_test_config',
    ]);
    $this->enableViewsTestModule();
    // Create two content types.
    $this->drupalCreateContentType([
        'type' => 'article',
    ]);
    $this->drupalCreateContentType([
        'type' => 'page',
    ]);
    // Create some random nodes: 5 articles, one page.
    for ($i = 0; $i < 5; $i++) {
        $this->drupalCreateNode([
            'type' => 'article',
        ]);
    }
    $this->drupalCreateNode([
        'type' => 'page',
    ]);
}

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