function NegotiationMiddlewareTest::testSetFormat
Same name in other branches
- 9 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()
- 11.x 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 123
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()
->shouldNotBeCalled();
$request_data = $this->prophesize(ParameterBag::class);
$request_data->get('ajax_iframe_upload', FALSE)
->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);
$request_mock->request = $request_data->reveal();
// Trigger handle.
$this->contentNegotiation
->registerFormat('david', 'geeky/david');
$this->contentNegotiation
->handle($request_mock);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.