You are here

public function NegotiationMiddlewareTest::testFormatViaQueryParameter in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testFormatViaQueryParameter()

Tests the specifying a format via query parameters gets used.

@covers ::getContentType

File

core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php, line 59
Contains \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest.

Class

NegotiationMiddlewareTest
@coversDefaultClass \Drupal\Core\StackMiddleware\NegotiationMiddleware @group NegotiationMiddleware

Namespace

Drupal\Tests\Core\StackMiddleware

Code

public function testFormatViaQueryParameter() {
  $request = new Request();
  $request->query
    ->set('_format', 'bob');
  $this
    ->assertSame('bob', $this->contentNegotiation
    ->getContentType($request));
}