You are here

public function PurgerDeleteFormTest::testRouteAccess in Purge 8.3

Test that the form route isn't accessible anonymously or on bad routes.

Overrides FormTestBase::testRouteAccess

File

modules/purge_ui/tests/src/Functional/Form/PurgerDeleteFormTest.php, line 104

Class

PurgerDeleteFormTest
Tests \Drupal\purge_ui\Form\PurgerDeleteForm.

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

public function testRouteAccess() : void {
  $this
    ->drupalGet($this
    ->getPath());
  $this
    ->assertSession()
    ->statusCodeEquals(403);

  // This overloaded test exists because the form is always accessible, even
  // under bad input, to allow the form submit handler to emit its Ajax
  // even directly after the purger got deleted.
  //
  // @see \Drupal\purge_ui\Form\PurgerDeleteForm::deletePurger
  $path = $this
    ->getPath($this->routeParametersInvalid);
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet($path);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}