function NegotiationMiddlewareTest::testSetFormat
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testSetFormat()
- 10 core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testSetFormat()
- 9 core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testSetFormat()
- 8.9.x core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testSetFormat()
Tests set format.
@legacy-covers ::registerFormat
File
-
core/
tests/ Drupal/ Tests/ Core/ StackMiddleware/ NegotiationMiddlewareTest.php, line 121
Class
Namespace
Drupal\Tests\Core\StackMiddlewareCode
public function testSetFormat() : void {
$httpKernel = $this->createMock(HttpKernelInterface::class);
$httpKernel->expects($this->once())
->method('handle')
->willReturn($this->createStub(Response::class));
$content_negotiation = new StubNegotiationMiddleware($httpKernel);
$request = new Request();
// Trigger handle.
$content_negotiation->registerFormat('david', 'geeky/david');
$content_negotiation->handle($request);
$this->assertSame('geeky/david', $request->getMimeType('david'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.