You are here

protected function BigPipeTest::assertBigPipeNoJsPlaceholders in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/big_pipe/tests/src/Functional/BigPipeTest.php \Drupal\Tests\big_pipe\Functional\BigPipeTest::assertBigPipeNoJsPlaceholders()
  2. 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.

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 344

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) {
  $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);
    }
  }
}