function BigPipeTest::testBigPipeMultiOccurrencePlaceholders
Tests BigPipe with a multi-occurrence placeholder.
File
-
core/
modules/ big_pipe/ tests/ src/ Functional/ BigPipeTest.php, line 308
Class
- BigPipeTest
- Tests BigPipe's no-JS detection & response delivery (with and without JS).
Namespace
Drupal\Tests\big_pipe\FunctionalCode
public function testBigPipeMultiOccurrencePlaceholders() : void {
$this->drupalLogin($this->rootUser);
$this->assertSessionCookieExists('1');
$this->assertBigPipeNoJsCookieExists('0');
// By not calling performMetaRefresh() here, we simulate JavaScript being
// enabled, because as far as the BigPipe module is concerned, JavaScript is
// enabled in the browser as long as the BigPipe no-JS cookie is *not* set.
// @see setUp()
// @see performMetaRefresh()
$this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence'));
$this->assertSession()
->pageTextContains('The count is 1.');
$this->assertSession()
->responseNotContains('The count is 2.');
$this->assertSession()
->responseNotContains('The count is 3.');
// By calling performMetaRefresh() here, we simulate JavaScript being
// disabled, because as far as the BigPipe module is concerned, it is
// enabled in the browser when the BigPipe no-JS cookie is set.
// @see setUp()
// @see performMetaRefresh()
$this->performMetaRefresh();
$this->assertBigPipeNoJsCookieExists('1');
$this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence'));
$this->assertSession()
->pageTextContains('The count is 1.');
$this->assertSession()
->responseNotContains('The count is 2.');
$this->assertSession()
->responseNotContains('The count is 3.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.