public function NegotiationMiddlewareTest::testSetFormat in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest::testSetFormat()
@covers ::registerFormat
File
- core/
tests/ Drupal/ Tests/ Core/ StackMiddleware/ NegotiationMiddlewareTest.php, line 121 - Contains \Drupal\Tests\Core\StackMiddleware\NegotiationMiddlewareTest.
Class
- NegotiationMiddlewareTest
- @coversDefaultClass \Drupal\Core\StackMiddleware\NegotiationMiddleware @group NegotiationMiddleware
Namespace
Drupal\Tests\Core\StackMiddlewareCode
public function testSetFormat() {
$request = $this
->prophesize(Request::class);
// Default empty format list should not set any formats.
$request
->setFormat('david', 'geeky/david')
->shouldBeCalled();
// Some calls we don't care about.
$request
->setRequestFormat('html')
->shouldBeCalled();
$request
->get('ajax_iframe_upload', false)
->shouldBeCalled();
$request_mock = $request
->reveal();
$request_mock->query = new ParameterBag([]);
// Trigger handle.
$this->contentNegotiation
->registerFormat('david', 'geeky/david');
$this->contentNegotiation
->handle($request_mock);
}