You are here

public function KeyAdminTest::testAdminUserRoutes in Key 8

Tests key routes for an authorized user.

File

tests/src/Functional/KeyAdminTest.php, line 81

Class

KeyAdminTest
Tests administration of keys.

Namespace

Drupal\Tests\key\Functional

Code

public function testAdminUserRoutes() {
  $this
    ->createTestKey('key_foo');
  $this
    ->createTestKeyConfigOverride('test_override', 'key_foo');
  $this
    ->drupalLogin($this->adminUser);
  $basicKeyRoutes = [
    'entity.key.collection' => [],
    'entity.key.add_form' => [],
    'entity.key.edit_form' => [
      'key' => 'key_foo',
    ],
    'entity.key.delete_form' => [
      'key' => 'key_foo',
    ],
  ];
  $overrideKeyRoutes = [
    'entity.key_config_override.collection' => [],
    'entity.key_config_override.add_form' => [],
    'entity.key_config_override.delete_form' => [
      'key_config_override' => 'test_override',
    ],
  ];
  $this
    ->routeAccessTest($basicKeyRoutes, 200);
  $this
    ->routeAccessTest($overrideKeyRoutes, 403);
}