You are here

public function SearchConfigSettingsFormTest::testRouteProtection in Drupal 8

Same name and namespace in other branches
  1. 9 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 347

Class

SearchConfigSettingsFormTest
Verify the search config settings form.

Namespace

Drupal\Tests\search\Functional

Code

public function testRouteProtection() {

  // 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);
}