You are here

protected function ConsumerConfigTest::grantClientRoles in farmOS 2.x

Helper function to grant roles to the client.

Parameters

array $role_ids: Role IDs to add.

Throws

\Drupal\Core\Entity\EntityStorageException

2 calls to ConsumerConfigTest::grantClientRoles()
ConsumerConfigTest::testLimitRequestedAccess in modules/core/api/tests/src/Functional/ConsumerConfigTest.php
Test consumer.limit_requested_access.
ConsumerConfigTest::testLimitUserAccess in modules/core/api/tests/src/Functional/ConsumerConfigTest.php
Test consumer.limit_user_access.

File

modules/core/api/tests/src/Functional/ConsumerConfigTest.php, line 247

Class

ConsumerConfigTest
Tests using the consumer.client_id field.

Namespace

Drupal\Tests\farm_api\Functional

Code

protected function grantClientRoles(array $role_ids) {
  $roles = [];
  foreach ($role_ids as $id) {
    $roles[] = [
      'target_id' => $id,
    ];
  }
  $this->client
    ->set('roles', $roles);
  $this->client
    ->save();
}