You are here

public function EntityResourceTest::testGetIndividual in JSON:API 8.2

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

@covers ::getIndividual

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Controller

Code

public function testGetIndividual() {
  $response = $this->entityResource
    ->getIndividual($this->node, Request::create('/jsonapi/node/article'));
  $this
    ->assertInstanceOf(JsonApiDocumentTopLevel::class, $response
    ->getResponseData());
  $resource_object = $response
    ->getResponseData()
    ->getData()
    ->getIterator()
    ->offsetGet(0);
  $this
    ->assertEquals($this->node
    ->uuid(), $resource_object
    ->getId());
}