You are here

protected function StyleSerializerTest::addRequestWithFormat in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/Tests/Views/StyleSerializerTest.php \Drupal\rest\Tests\Views\StyleSerializerTest::addRequestWithFormat()

Sets up a request on the request stack with a specified format.

Parameters

string $format: The new request format.

1 call to StyleSerializerTest::addRequestWithFormat()
StyleSerializerTest::testRestRenderCaching in core/modules/rest/src/Tests/Views/StyleSerializerTest.php
Tests REST export with views render caching enabled.

File

core/modules/rest/src/Tests/Views/StyleSerializerTest.php, line 195
Contains \Drupal\rest\Tests\Views\StyleSerializerTest.

Class

StyleSerializerTest
Tests the serializer style plugin.

Namespace

Drupal\rest\Tests\Views

Code

protected function addRequestWithFormat($format) {
  $request = \Drupal::request();
  $request = clone $request;
  $request
    ->setRequestFormat($format);
  \Drupal::requestStack()
    ->push($request);
}