You are here

public function PurgerAddFormTest::testRouteConditionalAccess in Purge 8.3

Tests that the form route is only accessible under the right conditions.

File

modules/purge_ui/tests/src/Functional/Form/PurgerAddFormTest.php, line 37

Class

PurgerAddFormTest
Tests \Drupal\purge_ui\Form\PurgerAddForm.

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

public function testRouteConditionalAccess() : void {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet($this
    ->getPath());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->initializePurgersService([
    'a',
    'b',
    'c',
  ]);
  $this
    ->drupalGet($this
    ->getPath());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->initializePurgersService([
    'a',
    'b',
    'c',
    'withform',
    'good',
  ]);
  $this
    ->drupalGet($this
    ->getPath());
  $this
    ->assertSession()
    ->statusCodeEquals(404);
}