function StandardJavascriptTest::assertBigPipePlaceholderReplacementCount

Same name in other branches
  1. 9 core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php \Drupal\Tests\standard\FunctionalJavascript\StandardJavascriptTest::assertBigPipePlaceholderReplacementCount()
  2. 8.9.x core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php \Drupal\Tests\standard\FunctionalJavascript\StandardJavascriptTest::assertBigPipePlaceholderReplacementCount()
  3. 11.x core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php \Drupal\Tests\standard\FunctionalJavascript\StandardJavascriptTest::assertBigPipePlaceholderReplacementCount()

Asserts the number of BigPipe placeholders that are replaced on the page.

Parameters

int $expected_count: The expected number of BigPipe placeholders.

1 call to StandardJavascriptTest::assertBigPipePlaceholderReplacementCount()
StandardJavascriptTest::testBigPipe in core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php
Tests BigPipe accelerates particular Standard installation profile routes.

File

core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php, line 55

Class

StandardJavascriptTest
Tests Standard installation profile JavaScript expectations.

Namespace

Drupal\Tests\standard\FunctionalJavascript

Code

protected function assertBigPipePlaceholderReplacementCount($expected_count) : void {
    $web_assert = $this->assertSession();
    $web_assert->waitForElement('css', 'script[data-big-pipe-event="stop"]');
    $page = $this->getSession()
        ->getPage();
    // Settings are removed as soon as they are processed.
    $this->assertCount(0, $this->getDrupalSettings()['bigPipePlaceholderIds']);
    $this->assertCount($expected_count, $page->findAll('css', 'script[data-big-pipe-replacement-for-placeholder-with-id]'));
}

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