You are here

public function ResourceResponseValidatorTest::testValidateResponse in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php \Drupal\Tests\jsonapi\Unit\EventSubscriber\ResourceResponseValidatorTest::testValidateResponse()

@covers ::validateResponse @dataProvider validateResponseProvider

File

tests/src/Unit/EventSubscriber/ResourceResponseValidatorTest.php, line 175

Class

ResourceResponseValidatorTest
@coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\EventSubscriber

Code

public function testValidateResponse($request, $response, $expected, $description) {

  // Expose protected ResourceResponseSubscriber::validateResponse() method.
  $object = new \ReflectionObject($this->subscriber);
  $method = $object
    ->getMethod('validateResponse');
  $method
    ->setAccessible(TRUE);
  $this
    ->assertSame($expected, $method
    ->invoke($this->subscriber, $response, $request), $description);
}