You are here

public function EntityToJsonApiTest::testRequestStack in JSON:API Extras 8.3

Test if the request by jsonapi_extras.entity.to_jsonapi doesn't linger on the request stack.

See also

https://www.drupal.org/project/jsonapi_extras/issues/3135950

https://www.drupal.org/project/jsonapi_extras/issues/3124805

File

tests/src/Kernel/EntityToJsonApiTest.php, line 219

Class

EntityToJsonApiTest
@coversDefaultClass \Drupal\jsonapi_extras\EntityToJsonApi @group jsonapi @group jsonapi_serializer @group legacy

Namespace

Drupal\Tests\jsonapi_extras\Kernel

Code

public function testRequestStack() {

  /** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */
  $request_stack = $this->container
    ->get('request_stack');
  $this->sut
    ->serialize($this->node);
  $request = $request_stack
    ->pop();
  $this
    ->assertNotEqual($request
    ->getPathInfo(), '/jsonapi/node/' . $this->nodeType
    ->id() . '/' . $this->node
    ->uuid(), 'The request from jsonapi_extras.entity.to_jsonapi should not linger in the request stack.');
}