src/Tests/BigPipeTest.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Tests/BigPipeTest.php b/src/Tests/BigPipeTest.php index b058be2..c224a78 100644 --- a/src/Tests/BigPipeTest.php +++ b/src/Tests/BigPipeTest.php @@ -49,11 +49,28 @@ class BigPipeTest extends WebTestBase { // Ignore the refresh that big_pipe.module sets. It causes a redirect // to a page that sets another cookie, which causes WebTestBase to lose the // session cookie. To avoid this problem, tests should first call - // drupalGet() and then call checkForMetaRefresh() manually. + // drupalGet() and then call checkForMetaRefresh() manually, and then reset + // $this->maximumMetaRefreshCount and $this->metaRefreshCount. + // @see doMetaRefresh() $this->maximumMetaRefreshCount = 0; } /** + * Performs a single refresh explicitly. + * + * This test disables the automatic refresh checking, each time it is + * desired that this runs, a test case must explicitly call this. + * + * @see setUp() + */ + protected function performMetaRefresh() { + $this->maximumMetaRefreshCount = 1; + $this->checkForMetaRefresh(); + $this->maximumMetaRefreshCount = 0; + $this->metaRefreshCount = 0; + } + + /** * Tests BigPipe's no-JS detection. * * Covers: @@ -240,7 +257,7 @@ class BigPipeTest extends WebTestBase { // 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() - $this->doMetaRefresh(); + $this->performMetaRefresh(); $this->assertBigPipeNoJsCookieExists(TRUE); $this->drupalGet(Url::fromRoute('big_pipe_test')); @@ -321,7 +338,7 @@ class BigPipeTest extends WebTestBase { protected function assertBigPipeNoJsMetaRefreshRedirect() { // Let the browser check for a meta refresh. $original_url = $this->url; - $this->doMetaRefresh(); + $this->performMetaRefresh(); $this->assertEqual($original_url, $this->url, 'Redirected back to the original location.'); @@ -343,11 +360,4 @@ class BigPipeTest extends WebTestBase { $this->assertNoRaw('