You are here

public function KeyNonAdminAccessTest::testNonAdminUserAccess in Key 8

Tests key routes for an unauthorized user.

File

tests/src/Functional/KeyNonAdminAccessTest.php, line 49

Class

KeyNonAdminAccessTest
Tests access for non-admin users.

Namespace

Drupal\Tests\key\Functional

Code

public function testNonAdminUserAccess() {
  $keyRoutes = [
    'entity.key.collection' => [],
    'entity.key.add_form' => [],
    'entity.key.edit_form' => [
      'key' => 'key_foo',
    ],
    'entity.key.delete_form' => [
      'key' => 'key_foo',
    ],
    'entity.key_config_override.collection' => [],
    'entity.key_config_override.add_form' => [],
    'entity.key_config_override.delete_form' => [
      'key_config_override' => 'test_override',
    ],
  ];
  $this
    ->routeAccessTest($keyRoutes, 403);
  $this
    ->drupalLogin($this->authenticatedUser);
  $this
    ->routeAccessTest($keyRoutes, 403);
}