function UserRegistrationRestTest::setUpAuthorization

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::setUpAuthorization()
  2. 11.x core/modules/user/tests/src/Functional/UserRegistrationRestTest.php \Drupal\Tests\user\Functional\UserRegistrationRestTest::setUpAuthorization()

Overrides ResourceTestBase::setUpAuthorization

1 call to UserRegistrationRestTest::setUpAuthorization()
UserRegistrationRestTest::setUp in core/modules/user/tests/src/Functional/UserRegistrationRestTest.php

File

core/modules/user/tests/src/Functional/UserRegistrationRestTest.php, line 241

Class

UserRegistrationRestTest
Tests registration of user using REST.

Namespace

Drupal\Tests\user\Functional

Code

protected function setUpAuthorization($method) {
    switch ($method) {
        case 'POST':
            $this->grantPermissionsToAuthenticatedRole([
                'restful post user_registration',
            ]);
            $this->grantPermissionsToAnonymousRole([
                'restful post user_registration',
            ]);
            break;
        default:
            throw new \UnexpectedValueException();
    }
}

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