You are here

public function EntityResourceTest::testGetIndividualDenied in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Controller/EntityResourceTest.php \Drupal\Tests\jsonapi\Kernel\Controller\EntityResourceTest::testGetIndividualDenied()

@covers ::getIndividual

File

tests/src/Kernel/Controller/EntityResourceTest.php, line 174

Class

EntityResourceTest
@coversDefaultClass \Drupal\jsonapi\Controller\EntityResource @group jsonapi @group legacy

Namespace

Drupal\Tests\jsonapi\Kernel\Controller

Code

public function testGetIndividualDenied() {
  $role = Role::load(RoleInterface::ANONYMOUS_ID);
  $role
    ->revokePermission('access content');
  $role
    ->save();
  $entity_resource = $this
    ->buildEntityResource('node', 'article');
  $this
    ->setExpectedException(EntityAccessDeniedHttpException::class);
  $entity_resource
    ->getIndividual($this->node, new Request());
}