function ContentLengthTest::testHandle
Same name in this branch
- 10 core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php \Drupal\Tests\Core\StackMiddleware\ContentLengthTest::testHandle()
Same name in other branches
- 11.x core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php \Drupal\Tests\big_pipe\Unit\StackMiddleware\ContentLengthTest::testHandle()
- 11.x core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php \Drupal\Tests\Core\StackMiddleware\ContentLengthTest::testHandle()
@covers ::handle @dataProvider providerTestSetContentLengthHeader
File
-
core/
modules/ big_pipe/ tests/ src/ Unit/ StackMiddleware/ ContentLengthTest.php, line 27
Class
- ContentLengthTest
- Defines a test for ContentLength middleware.
Namespace
Drupal\Tests\big_pipe\Unit\StackMiddlewareCode
public function testHandle(false|int $expected_header, Response $response) : void {
$kernel = $this->prophesize(HttpKernelInterface::class);
$request = Request::create('/');
$kernel->handle($request, HttpKernelInterface::MAIN_REQUEST, TRUE)
->willReturn($response);
$middleware = new ContentLength($kernel->reveal());
$response = $middleware->handle($request);
if ($expected_header === FALSE) {
$this->assertFalse($response->headers
->has('Content-Length'));
return;
}
$this->assertSame((string) $expected_header, $response->headers
->get('Content-Length'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.