function BigPipeStrategyTest::placeholdersProvider

Same name in other branches
  1. 9 core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php \Drupal\Tests\big_pipe\Unit\Render\Placeholder\BigPipeStrategyTest::placeholdersProvider()
  2. 8.9.x core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php \Drupal\Tests\big_pipe\Unit\Render\Placeholder\BigPipeStrategyTest::placeholdersProvider()
  3. 10 core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php \Drupal\Tests\big_pipe\Unit\Render\Placeholder\BigPipeStrategyTest::placeholdersProvider()

See also

\Drupal\big_pipe_test\BigPipePlaceholderTestCases

File

core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php, line 66

Class

BigPipeStrategyTest
@coversDefaultClass \Drupal\big_pipe\Render\Placeholder\BigPipeStrategy @group big_pipe

Namespace

Drupal\Tests\big_pipe\Unit\Render\Placeholder

Code

public static function placeholdersProvider() {
    $cases = BigPipePlaceholderTestCases::cases();
    // Generate $placeholders variable as expected by
    // \Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface::processPlaceholders().
    $placeholders = [
        $cases['html']->placeholder => $cases['html']->placeholderRenderArray,
        $cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->placeholderRenderArray,
        $cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->placeholderRenderArray,
        $cases['edge_case__invalid_html']->placeholder => $cases['edge_case__invalid_html']->placeholderRenderArray,
        $cases['edge_case__html_non_lazy_builder']->placeholder => $cases['edge_case__html_non_lazy_builder']->placeholderRenderArray,
        $cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->placeholderRenderArray,
        $cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->placeholderRenderArray,
    ];
    return [
        '_no_big_pipe absent, no session, no-JS cookie absent' => [
            $placeholders,
            'GET',
            FALSE,
            FALSE,
            FALSE,
            [],
        ],
        '_no_big_pipe absent, no session, no-JS cookie present' => [
            $placeholders,
            'GET',
            FALSE,
            FALSE,
            TRUE,
            [],
        ],
        '_no_big_pipe present, no session, no-JS cookie absent' => [
            $placeholders,
            'GET',
            TRUE,
            FALSE,
            FALSE,
            [],
        ],
        '_no_big_pipe present, no session, no-JS cookie present' => [
            $placeholders,
            'GET',
            TRUE,
            FALSE,
            TRUE,
            [],
        ],
        '_no_big_pipe present, session, no-JS cookie absent' => [
            $placeholders,
            'GET',
            TRUE,
            TRUE,
            FALSE,
            [],
        ],
        '_no_big_pipe present, session, no-JS cookie present' => [
            $placeholders,
            'GET',
            TRUE,
            TRUE,
            TRUE,
            [],
        ],
        '_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders' => [
            $placeholders,
            'GET',
            FALSE,
            TRUE,
            FALSE,
            [
                $cases['html']->placeholder => $cases['html']->bigPipePlaceholderRenderArray,
                $cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->bigPipeNoJsPlaceholderRenderArray,
                $cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->bigPipeNoJsPlaceholderRenderArray,
                $cases['edge_case__invalid_html']->placeholder => $cases['edge_case__invalid_html']->bigPipeNoJsPlaceholderRenderArray,
                $cases['edge_case__html_non_lazy_builder']->placeholder => $cases['edge_case__html_non_lazy_builder']->bigPipePlaceholderRenderArray,
                $cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->bigPipePlaceholderRenderArray,
                $cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->bigPipePlaceholderRenderArray,
            ],
        ],
        '_no_big_pipe absent, session, no-JS cookie absent: (JS-powered) BigPipe placeholder used for HTML placeholders — but unsafe method' => [
            $placeholders,
            'POST',
            FALSE,
            TRUE,
            FALSE,
            [],
        ],
        '_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders' => [
            $placeholders,
            'GET',
            FALSE,
            TRUE,
            TRUE,
            [
                $cases['html']->placeholder => $cases['html']->bigPipeNoJsPlaceholderRenderArray,
                $cases['html_attribute_value']->placeholder => $cases['html_attribute_value']->bigPipeNoJsPlaceholderRenderArray,
                $cases['html_attribute_value_subset']->placeholder => $cases['html_attribute_value_subset']->bigPipeNoJsPlaceholderRenderArray,
                $cases['edge_case__invalid_html']->placeholder => $cases['edge_case__invalid_html']->bigPipeNoJsPlaceholderRenderArray,
                $cases['edge_case__html_non_lazy_builder']->placeholder => $cases['edge_case__html_non_lazy_builder']->bigPipeNoJsPlaceholderRenderArray,
                $cases['exception__lazy_builder']->placeholder => $cases['exception__lazy_builder']->bigPipeNoJsPlaceholderRenderArray,
                $cases['exception__embedded_response']->placeholder => $cases['exception__embedded_response']->bigPipeNoJsPlaceholderRenderArray,
            ],
        ],
        '_no_big_pipe absent, session, no-JS cookie present: no-JS BigPipe placeholder used for HTML placeholders — but unsafe method' => [
            $placeholders,
            'POST',
            FALSE,
            TRUE,
            TRUE,
            [],
        ],
    ];
}

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