You are here

protected function UserTest::setUpAuthorization in Drupal 10

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

File

core/modules/jsonapi/tests/src/Functional/UserTest.php, line 82

Class

UserTest
JSON:API integration test for the "User" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function setUpAuthorization($method) {

  // @todo Remove this in
  $this
    ->grantPermissionsToTestedRole([
    'access content',
  ]);
  switch ($method) {
    case 'GET':
      $this
        ->grantPermissionsToTestedRole([
        'access user profiles',
      ]);
      break;
    case 'POST':
    case 'PATCH':
    case 'DELETE':
      $this
        ->grantPermissionsToTestedRole([
        'administer users',
      ]);
      break;
  }
}