function ShortcutSetResourceTestBase::setUpAuthorization

Same name in other branches
  1. 9 core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutSetResourceTestBase::setUpAuthorization()
  2. 10 core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutSetResourceTestBase::setUpAuthorization()
  3. 11.x core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php \Drupal\Tests\shortcut\Functional\Rest\ShortcutSetResourceTestBase::setUpAuthorization()

Overrides ResourceTestBase::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;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.