You are here

public function FormTestBase::testRouteAccess in Purge 8.3

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

1 method overrides FormTestBase::testRouteAccess()
PurgerDeleteFormTest::testRouteAccess in modules/purge_ui/tests/src/Functional/Form/PurgerDeleteFormTest.php
Test that the form route isn't accessible anonymously or on bad routes.

File

modules/purge_ui/tests/src/Functional/Form/FormTestBase.php, line 246

Class

FormTestBase
Testbase for purge_ui forms.

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

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

  // Only test for bad route input, when ::$routeParametersInvalid is set.
  if (!is_null($this->routeParametersInvalid)) {
    $path = $this
      ->getPath($this->routeParametersInvalid);
    $this
      ->drupalLogin($this->adminUser);
    $this
      ->drupalGet($path);
    $this
      ->assertSession()
      ->statusCodeEquals(404);
  }
}