function ContentLengthTest::providerTestSetContentLengthHeader

Same name in this branch
  1. 10 core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php \Drupal\Tests\big_pipe\Unit\StackMiddleware\ContentLengthTest::providerTestSetContentLengthHeader()
Same name in other branches
  1. 11.x core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php \Drupal\Tests\big_pipe\Unit\StackMiddleware\ContentLengthTest::providerTestSetContentLengthHeader()
  2. 11.x core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php \Drupal\Tests\Core\StackMiddleware\ContentLengthTest::providerTestSetContentLengthHeader()

File

core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php, line 37

Class

ContentLengthTest
@coversDefaultClass \Drupal\Core\StackMiddleware\ContentLength @group Middleware

Namespace

Drupal\Tests\Core\StackMiddleware

Code

public static function providerTestSetContentLengthHeader() {
    return [
        'Informational' => [
            FALSE,
            new Response('', 101),
        ],
        '200 ok' => [
            12,
            new Response('Test content', 200),
        ],
        '204' => [
            FALSE,
            new Response('Test content', 204),
        ],
        '304' => [
            FALSE,
            new Response('Test content', 304),
        ],
        'Client error' => [
            13,
            new Response('Access denied', 403),
        ],
        'Server error' => [
            FALSE,
            new Response('Test content', 500),
        ],
        '200 with transfer-encoding' => [
            FALSE,
            new Response('Test content', 200, [
                'Transfer-Encoding' => 'Chunked',
            ]),
        ],
        '200 with FalseContentResponse' => [
            FALSE,
            new FalseContentResponse('Test content', 200),
        ],
        '200 with StreamedResponse' => [
            FALSE,
            new StreamedResponse(status: 200),
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.