You are here

protected static function ProductVariationResourceTest::entityAccess in Commerce Core 8.2

Checks access for the given operation on the given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check field access.

string $operation: The operation for which to check access.

\Drupal\Core\Session\AccountInterface $account: The account for which to check access.

Return value

\Drupal\Core\Access\AccessResultInterface The AccessResult.

Overrides ResourceTestBase::entityAccess

File

modules/product/tests/src/Functional/Jsonapi/ProductVariationResourceTest.php, line 388

Class

ProductVariationResourceTest
JSON:API resource test for variations.

Namespace

Drupal\Tests\commerce_product\Functional\Jsonapi

Code

protected static function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) {

  // Also clear the 'commerce_product' entity access handler cache because
  // the 'commerce_product_variation' access handler delegates access to it.
  // @see \Drupal\commerce_product\ProductVariationAccessControlHandler::checkAccess()
  \Drupal::entityTypeManager()
    ->getAccessControlHandler('commerce_product')
    ->resetCache();
  return parent::entityAccess($entity, $operation, $account);
}