function ExposedFilterAJAXTest::setUp

Same name in other branches
  1. 9 core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest::setUp()
  2. 8.9.x core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest::setUp()
  3. 10 core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php \Drupal\Tests\views\FunctionalJavascript\ExposedFilterAJAXTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php, line 47

Class

ExposedFilterAJAXTest
Tests the basic AJAX functionality of Views exposed forms.

Namespace

Drupal\Tests\views\FunctionalJavascript

Code

protected function setUp() : void {
    parent::setUp();
    // Enable AJAX on the /admin/content View.
    \Drupal::configFactory()->getEditable('views.view.content')
        ->set('display.default.display_options.use_ajax', TRUE)
        ->save();
    // Import user_test_views and set it to use ajax.
    ViewTestData::createTestViews(get_class($this), [
        'user_test_views',
    ]);
    \Drupal::configFactory()->getEditable('views.view.test_user_name')
        ->set('display.default.display_options.use_ajax', TRUE)
        ->save();
    // Create a Content type and two test nodes.
    $this->createContentType([
        'type' => 'page',
    ]);
    $this->createNode([
        'title' => 'Page One',
    ]);
    $this->createNode([
        'title' => 'Page Two',
    ]);
    // Create a user privileged enough to use exposed filters and view content.
    $user = $this->drupalCreateUser([
        'administer site configuration',
        'access content',
        'access content overview',
        'edit any page content',
        'view the administration theme',
    ]);
    $this->drupalLogin($user);
}

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