function BigPipeTest::assertBigPipeNoJsPlaceholders

Same name in other branches
  1. 9 core/modules/big_pipe/tests/src/Functional/BigPipeTest.php \Drupal\Tests\big_pipe\Functional\BigPipeTest::assertBigPipeNoJsPlaceholders()
  2. 8.9.x core/modules/big_pipe/tests/src/Functional/BigPipeTest.php \Drupal\Tests\big_pipe\Functional\BigPipeTest::assertBigPipeNoJsPlaceholders()
  3. 10 core/modules/big_pipe/tests/src/Functional/BigPipeTest.php \Drupal\Tests\big_pipe\Functional\BigPipeTest::assertBigPipeNoJsPlaceholders()

Asserts expected BigPipe no-JS placeholders are present and replaced.

@internal

Parameters

array $expected_big_pipe_nojs_placeholders: Keys: BigPipe no-JS placeholder markup. Values: expected replacement markup.

2 calls to BigPipeTest::assertBigPipeNoJsPlaceholders()
BigPipeTest::testBigPipe in core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
Tests BigPipe-delivered HTML responses when JavaScript is enabled.
BigPipeTest::testBigPipeNoJs in core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
Tests BigPipe-delivered HTML responses when JavaScript is disabled.

File

core/modules/big_pipe/tests/src/Functional/BigPipeTest.php, line 358

Class

BigPipeTest
Tests BigPipe's no-JS detection & response delivery (with and without JS).

Namespace

Drupal\Tests\big_pipe\Functional

Code

protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_placeholders) : void {
    $this->assertSetsEqual(array_keys($expected_big_pipe_nojs_placeholders), array_map('rawurldecode', explode(' ', $this->getSession()
        ->getResponseHeader('BigPipe-Test-No-Js-Placeholders'))));
    foreach ($expected_big_pipe_nojs_placeholders as $big_pipe_nojs_placeholder => $expected_replacement) {
        // Checking whether the replacement for the BigPipe no-JS placeholder
        // $big_pipe_nojs_placeholder is present.
        $this->assertSession()
            ->responseNotContains($big_pipe_nojs_placeholder);
        if ($expected_replacement !== NULL) {
            $this->assertSession()
                ->responseContains($expected_replacement);
        }
    }
}

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