You are here

protected function ShortcutSetResourceTestBase::setUpAuthorization in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutSetResourceTestBase::setUpAuthorization()
  2. 9 core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutSetResourceTestBase::setUpAuthorization()

File

core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php, line 38

Class

ShortcutSetResourceTestBase
ResourceTestBase for ShortcutSet entity.

Namespace

Drupal\Tests\shortcut\Functional\Rest

Code

protected function setUpAuthorization($method) {
  switch ($method) {
    case 'GET':
      $this
        ->grantPermissionsToTestedRole([
        'access shortcuts',
      ]);
      break;
    case 'POST':
    case 'PATCH':
      $this
        ->grantPermissionsToTestedRole([
        'access shortcuts',
        'customize shortcut links',
      ]);
      break;
    case 'DELETE':
      $this
        ->grantPermissionsToTestedRole([
        'administer shortcuts',
      ]);
      break;
  }
}