You are here

protected function ApiProductAccessTest::messageIfUserShouldHaveAccessByRole in Apigee Edge 8

Error message, when a user should have access to an API product by role.

Parameters

string $operation: Operation on API product.

\Drupal\user\UserInterface $user: User object.

string $user_rid: Currently tested role of the user.

array $rids_with_access: Roles with access to the API product.

\Drupal\apigee_edge\Entity\ApiProductInterface $product: API Product.

Return value

string Error message.

1 call to ApiProductAccessTest::messageIfUserShouldHaveAccessByRole()
ApiProductAccessTest::entityAccessTest in tests/src/FunctionalJavascript/ApiProductAccessTest.php
Tests "Access by visibility" access control.
1 method overrides ApiProductAccessTest::messageIfUserShouldHaveAccessByRole()
ApiProductRoleBasedAccessTestBase::messageIfUserShouldHaveAccessByRole in modules/apigee_edge_apiproduct_rbac/tests/src/FunctionalJavascript/ApiProductRoleBasedAccessTestBase.php
Error message, when a user should have access to an API product by role.

File

tests/src/FunctionalJavascript/ApiProductAccessTest.php, line 454

Class

ApiProductAccessTest
Validates built-in access control on API products.

Namespace

Drupal\Tests\apigee_edge\FunctionalJavascript

Code

protected function messageIfUserShouldHaveAccessByRole(string $operation, UserInterface $user, string $user_rid, array $rids_with_access, ApiProductInterface $product) : string {
  return sprintf('User with "%s" role should have "%s" access to an API Product with "%s" visibility. Roles with access granted: %s.', $user_rid, $operation, $product
    ->getAttributeValue('access') ?? 'public', empty($rids_with_access) ? 'none' : implode(', ', $rids_with_access));
}