You are here

public function NegotiationMiddlewareTest::testUnknowContentTypeButAjaxRequest in Zircon Profile 8

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

Tests the getContentType() method when no priority format is found but it's an AJAX request.

@covers ::getContentType

File

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

Class

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

Namespace

Drupal\Tests\Core\StackMiddleware

Code

public function testUnknowContentTypeButAjaxRequest() {
  $request = new Request();
  $request->headers
    ->set('X-Requested-With', 'XMLHttpRequest');
  $this
    ->assertSame('html', $this->contentNegotiation
    ->getContentType($request));
}