function BlockUiTest::testRouteProtection
Same name in other branches
- 9 core/modules/block/tests/src/Functional/BlockUiTest.php \Drupal\Tests\block\Functional\BlockUiTest::testRouteProtection()
- 8.9.x core/modules/block/tests/src/Functional/BlockUiTest.php \Drupal\Tests\block\Functional\BlockUiTest::testRouteProtection()
- 10 core/modules/block/tests/src/Functional/BlockUiTest.php \Drupal\Tests\block\Functional\BlockUiTest::testRouteProtection()
Tests that the enable/disable routes are protected from CSRF.
File
-
core/
modules/ block/ tests/ src/ Functional/ BlockUiTest.php, line 368
Class
- BlockUiTest
- Tests that the block configuration UI exists and stores data correctly.
Namespace
Drupal\Tests\block\FunctionalCode
public function testRouteProtection() : void {
// Get the first block generated in our setUp method.
/** @var \Drupal\block\BlockInterface $block */
$block = reset($this->blocks);
// Ensure that the enable and disable routes are protected.
$this->drupalGet('admin/structure/block/manage/' . $block->id() . '/disable');
$this->assertSession()
->statusCodeEquals(403);
$this->drupalGet('admin/structure/block/manage/' . $block->id() . '/enable');
$this->assertSession()
->statusCodeEquals(403);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.