function NegotiationMiddlewareTest::testFormatViaQueryParameter

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testFormatViaQueryParameter()
  2. 10 core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testFormatViaQueryParameter()
  3. 11.x 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 60

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.