function SearchConfigSettingsFormTest::testRouteProtection

Same name in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::testRouteProtection()
  2. 8.9.x core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::testRouteProtection()
  3. 10 core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::testRouteProtection()

Tests that the enable/disable/default routes are protected from CSRF.

File

core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php, line 363

Class

SearchConfigSettingsFormTest
Verify the search config settings form.

Namespace

Drupal\Tests\search\Functional

Code

public function testRouteProtection() : void {
    // Ensure that the enable and disable routes are protected.
    $this->drupalGet('admin/config/search/pages/manage/node_search/enable');
    $this->assertSession()
        ->statusCodeEquals(403);
    $this->drupalGet('admin/config/search/pages/manage/node_search/disable');
    $this->assertSession()
        ->statusCodeEquals(403);
    $this->drupalGet('admin/config/search/pages/manage/node_search/set-default');
    $this->assertSession()
        ->statusCodeEquals(403);
}

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