core/MAINTAINERS.txt | 4 ++ core/modules/big_pipe/big_pipe.services.yml | 7 -- .../Cache/Context/SessionExistsCacheContext.php | 70 -------------------- .../src/Tests/SessionExistsCacheContextTest.php | 76 ---------------------- .../session_exists_cache_context_test.info.yml | 6 -- .../session_exists_cache_context_test.module | 24 ------- 6 files changed, 4 insertions(+), 183 deletions(-) diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt index 021f5a4..18caa1d 100644 --- a/core/MAINTAINERS.txt +++ b/core/MAINTAINERS.txt @@ -267,6 +267,10 @@ Basic Auth module - Klaus Purer 'klausi' https://www.drupal.org/u/klausi - Juampy Novillo Requena 'juampy' https://www.drupal.org/u/juampy +BigPipe module +- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers +- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx + Block module - Tim Plunkett 'tim.plunkett' https://www.drupal.org/u/tim.plunkett - Ben Dougherty 'benjy' https://www.drupal.org/u/benjy diff --git a/core/modules/big_pipe/big_pipe.services.yml b/core/modules/big_pipe/big_pipe.services.yml index cf5ca80..b8ff9d4 100644 --- a/core/modules/big_pipe/big_pipe.services.yml +++ b/core/modules/big_pipe/big_pipe.services.yml @@ -18,10 +18,3 @@ services: decorates: html_response.attachments_processor decoration_inner_name: html_response.attachments_processor.original arguments: ['@html_response.attachments_processor.original', '@asset.resolver', '@config.factory', '@asset.css.collection_renderer', '@asset.js.collection_renderer', '@request_stack', '@renderer', '@module_handler'] - - # @todo Move this into Drupal 8 core. - cache_context.session.exists: - class: Drupal\big_pipe\Cache\Context\SessionExistsCacheContext - arguments: ['@session_configuration', '@request_stack'] - tags: - - { name: cache.context} diff --git a/core/modules/big_pipe/src/Cache/Context/SessionExistsCacheContext.php b/core/modules/big_pipe/src/Cache/Context/SessionExistsCacheContext.php deleted file mode 100644 index f1ca0c9..0000000 --- a/core/modules/big_pipe/src/Cache/Context/SessionExistsCacheContext.php +++ /dev/null @@ -1,70 +0,0 @@ -sessionConfiguration = $session_configuration; - $this->requestStack = $request_stack; - } - - /** - * {@inheritdoc} - */ - public static function getLabel() { - return t('Session exists'); - } - - /** - * {@inheritdoc} - */ - public function getContext() { - return $this->sessionConfiguration->hasSession($this->requestStack->getCurrentRequest()) ? '1' : '0'; - } - - /** - * {@inheritdoc} - */ - public function getCacheableMetadata() { - return new CacheableMetadata(); - } - -} diff --git a/core/modules/big_pipe/src/Tests/SessionExistsCacheContextTest.php b/core/modules/big_pipe/src/Tests/SessionExistsCacheContextTest.php deleted file mode 100644 index 9ca1e89..0000000 --- a/core/modules/big_pipe/src/Tests/SessionExistsCacheContextTest.php +++ /dev/null @@ -1,76 +0,0 @@ -dumpHeaders = TRUE; - - // 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. - $this->maximumMetaRefreshCount = 0; - - // 1. No session (anonymous). - $this->assertSessionCookieOnClient(FALSE); - $this->drupalGet(Url::fromRoute('')); - $this->assertSessionCookieOnClient(FALSE); - $this->assertRaw('Session does not exist!'); - $this->assertRaw('[session.exists]=0'); - - // 2. Session (authenticated). - $this->assertSessionCookieOnClient(FALSE); - $this->drupalLogin($this->rootUser); - $this->assertSessionCookieOnClient(TRUE); - $this->assertRaw('Session exists!'); - $this->assertRaw('[session.exists]=1'); - $this->drupalLogout(); - $this->assertSessionCookieOnClient(FALSE); - $this->assertRaw('Session does not exist!'); - $this->assertRaw('[session.exists]=0'); - - // 3. Session (anonymous). - $this->assertSessionCookieOnClient(FALSE); - $this->drupalGet(Url::fromRoute('', [], ['query' => ['trigger_session' => 1]])); - $this->assertSessionCookieOnClient(TRUE); - $this->assertRaw('Session does not exist!'); - $this->assertRaw('[session.exists]=0'); - $this->drupalGet(Url::fromRoute('')); - $this->assertSessionCookieOnClient(TRUE); - $this->assertRaw('Session exists!'); - $this->assertRaw('[session.exists]=1'); - } - - /** - * Asserts whether a session cookie is present on the client or not. - */ - function assertSessionCookieOnClient($expected_present) { - $non_deleted_cookies = array_filter($this->cookies, function ($item) { return $item['value'] !== 'deleted'; }); - $this->assertEqual($expected_present, isset($non_deleted_cookies[$this->getSessionName()]), 'Session cookie exists.'); - } - -} diff --git a/core/modules/big_pipe/tests/modules/session_exists_cache_context_test/session_exists_cache_context_test.info.yml b/core/modules/big_pipe/tests/modules/session_exists_cache_context_test/session_exists_cache_context_test.info.yml deleted file mode 100644 index b376a57..0000000 --- a/core/modules/big_pipe/tests/modules/session_exists_cache_context_test/session_exists_cache_context_test.info.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: 'session.exists cache context test' -type: module -description: 'Support module for session.exists cache context testing.' -package: Testing -version: VERSION -core: 8.x diff --git a/core/modules/big_pipe/tests/modules/session_exists_cache_context_test/session_exists_cache_context_test.module b/core/modules/big_pipe/tests/modules/session_exists_cache_context_test/session_exists_cache_context_test.module deleted file mode 100644 index b4179c0..0000000 --- a/core/modules/big_pipe/tests/modules/session_exists_cache_context_test/session_exists_cache_context_test.module +++ /dev/null @@ -1,24 +0,0 @@ -hasSession($request); - $page_top['session_exists_cache_context_test'] = [ - 'label' => [ - '#markup' => '

' . ($session_exists ? 'Session exists!' : 'Session does not exist!') . '

', - ], - 'cache_context_value' => [ - '#markup' => '[session.exists]=' . \Drupal::service('cache_context.session.exists')->getContext() . '', - ], - ]; - - if (\Drupal::request()->query->get('trigger_session')) { - $_SESSION['session_exists_cache_context_test'] = TRUE; - } -}