You are here

protected function ApiDocsAccessTest::assertApiDocAccess in Apigee API Catalog 8

Checks access on apidoc.

Parameters

\Drupal\apigee_api_catalog\Entity\ApiDoc $apidoc: An apidoc entity.

string $access_operation: The entity operation, e.g. 'view', 'edit', 'delete', etc.

bool $access_allowed: Whether the current use has access to the given operation or not.

string $access_reason: (optional) The reason of the access result.

7 calls to ApiDocsAccessTest::assertApiDocAccess()
ApiDocsAccessTest::testApiDocAccessAdd in tests/src/Functional/ApiDocsAccessTest.php
Test add permissions for apidocs.
ApiDocsAccessTest::testApiDocAccessAdmin in tests/src/Functional/ApiDocsAccessTest.php
Test admin access control functionality for apidocs.
ApiDocsAccessTest::testApiDocAccessDelete in tests/src/Functional/ApiDocsAccessTest.php
Test delete permission for apidocs.
ApiDocsAccessTest::testApiDocAccessEdit in tests/src/Functional/ApiDocsAccessTest.php
Test edit permission for apidocs.
ApiDocsAccessTest::testApiDocAccessNoPermissions in tests/src/Functional/ApiDocsAccessTest.php
Test no permissions for apidocs.

... See full list

File

tests/src/Functional/ApiDocsAccessTest.php, line 410

Class

ApiDocsAccessTest
Tests the ApiDoc term access permissions.

Namespace

Drupal\Tests\apigee_api_catalog\Functional

Code

protected function assertApiDocAccess(ApiDoc $apidoc, $access_operation, $access_allowed, $access_reason = '') {
  $access_result = $apidoc
    ->access($access_operation, NULL, TRUE);
  $this
    ->assertSame($access_allowed, $access_result
    ->isAllowed());
  if ($access_reason) {
    $this
      ->assertSame($access_reason, $access_result
      ->getReason());
  }
}