function UITestBase::drupalGet

Same name in this branch
  1. 8.9.x core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::drupalGet()
Same name and namespace in other branches
  1. 9 core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::drupalGet()
  2. 10 core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::drupalGet()
  3. 11.x core/modules/views_ui/tests/src/Functional/UITestBase.php \Drupal\Tests\views_ui\Functional\UITestBase::drupalGet()

Overrides WebTestBase::drupalGet

File

core/modules/views_ui/src/Tests/UITestBase.php, line 84

Class

UITestBase
Provides a base class for testing the Views UI.

Namespace

Drupal\views_ui\Tests

Code

protected function drupalGet($path, array $options = [], array $headers = []) {
    $url = $this->buildUrl($path, $options);
    // Ensure that each nojs page is accessible via ajax as well.
    if (strpos($url, 'nojs') !== FALSE) {
        $url = str_replace('nojs', 'ajax', $url);
        $result = $this->drupalGet($url, $options, $headers);
        $this->assertResponse(200);
        $this->assertHeader('Content-Type', 'application/json');
        $this->assertTrue(json_decode($result), 'Ensure that the AJAX request returned valid content.');
    }
    return parent::drupalGet($path, $options, $headers);
}

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