Skip to content
Snippets Groups Projects
Verified Commit de6e4c69 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3469335 by catch, smustgrave: Speed up PageCacheTest

parent 5afca8ca
No related branches found
No related tags found
20 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #261051 passed with warnings
Pipeline: drupal

#261072

    Pipeline: drupal

    #261067

      Pipeline: drupal

      #261059

        +2
        ......@@ -53,7 +53,7 @@ protected function setUp(): void {
        * Since tag based invalidation works, we know that our tag properly
        * persisted.
        */
        public function testPageCacheTags(): void {
        protected function testPageCacheTags(): void {
        $this->enablePageCaching();
        $path = 'system-test/cache_tags_page';
        ......@@ -85,7 +85,7 @@ public function testPageCacheTags(): void {
        /**
        * Tests that the page cache doesn't depend on cacheability headers.
        */
        public function testPageCacheTagsIndependentFromCacheabilityHeaders(): void {
        protected function testPageCacheTagsIndependentFromCacheabilityHeaders(): void {
        // Disable the cacheability headers.
        $this->setContainerParameter('http.response.debug_cacheability_headers', FALSE);
        $this->rebuildContainer();
        ......@@ -216,12 +216,38 @@ public function testConditionalRequests(): void {
        $this->assertSession()->statusCodeEquals(200);
        // Verify that absence of Page was not cached.
        $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache');
        $this->drupalLogout();
        }
        /**
        * Tests cache headers.
        * Tests page caching.
        */
        public function testPageCache(): void {
        $this->testCacheableWithCustomCacheControl();
        \Drupal::service('cache.page')->deleteAll();
        $this->testPageCacheAnonymous403404();
        \Drupal::service('cache.page')->deleteAll();
        $this->testCacheabilityOfRedirectResponses();
        \Drupal::service('cache.page')->deleteAll();
        $this->testNoUrlNormalization();
        \Drupal::service('cache.page')->deleteAll();
        $this->testPageCacheHeaders();
        \Drupal::service('cache.page')->deleteAll();
        $this->testPageCacheWithoutVaryCookie();
        \Drupal::service('cache.page')->deleteAll();
        $this->testPageCacheTags();
        \Drupal::service('cache.page')->deleteAll();
        $this->testPageCacheAnonymousRolePermissions();
        \Drupal::service('cache.page')->deleteAll();
        $this->testHead();
        \Drupal::service('cache.page')->deleteAll();
        $this->testPageCacheTagsIndependentFromCacheabilityHeaders();
        }
        /**
        * Tests page cache headers.
        */
        protected function testPageCacheHeaders(): void {
        $this->enablePageCaching();
        // Fill the cache.
        ......@@ -279,7 +305,7 @@ public function testPageCache(): void {
        * This test verifies that, and it verifies that it does not happen for other
        * roles.
        */
        public function testPageCacheAnonymousRolePermissions(): void {
        protected function testPageCacheAnonymousRolePermissions(): void {
        $this->enablePageCaching();
        $content_url = Url::fromRoute('system_test.permission_dependent_content');
        ......@@ -324,12 +350,13 @@ public function testPageCacheAnonymousRolePermissions(): void {
        $this->drupalGet($route_access_url);
        $this->assertCacheContext('user.permissions');
        $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:user.role.authenticated');
        $this->drupalLogout();
        }
        /**
        * Tests the 4xx-response cache tag is added and invalidated.
        */
        public function testPageCacheAnonymous403404(): void {
        protected function testPageCacheAnonymous403404(): void {
        $admin_url = Url::fromRoute('system.admin');
        $invalid_url = 'foo/does_not_exist';
        $tests = [
        ......@@ -400,12 +427,18 @@ public function testPageCacheAnonymous403404(): void {
        $this->assertSession()->statusCodeEquals($code);
        $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS');
        }
        // Restore 403 and 404 caching.
        $settings['settings']['cache_ttl_4xx'] = (object) [
        'value' => 3600,
        'required' => TRUE,
        ];
        $this->writeSettings($settings);
        }
        /**
        * Tests the omit_vary_cookie setting.
        */
        public function testPageCacheWithoutVaryCookie(): void {
        protected function testPageCacheWithoutVaryCookie(): void {
        $this->enablePageCaching();
        $settings['settings']['omit_vary_cookie'] = (object) [
        ......@@ -507,7 +540,7 @@ public function testCacheableResponseResponses(): void {
        /**
        * Tests that HEAD requests are treated the same as GET requests.
        */
        public function testHead(): void {
        protected function testHead(): void {
        /** @var \GuzzleHttp\ClientInterface $client */
        $client = $this->getSession()->getDriver()->getClient()->getClient();
        ......@@ -537,7 +570,7 @@ public function testHead(): void {
        /**
        * Tests a cacheable response with custom cache control.
        */
        public function testCacheableWithCustomCacheControl(): void {
        protected function testCacheableWithCustomCacheControl(): void {
        $this->enablePageCaching();
        $this->drupalGet('/system-test/custom-cache-control');
        ......@@ -548,7 +581,7 @@ public function testCacheableWithCustomCacheControl(): void {
        /**
        * Tests that the Cache-Control header is added by FinishResponseSubscriber.
        */
        public function testCacheabilityOfRedirectResponses(): void {
        protected function testCacheabilityOfRedirectResponses(): void {
        $this->enablePageCaching();
        $this->getSession()->getDriver()->getClient()->followRedirects(FALSE);
        ......@@ -561,12 +594,13 @@ public function testCacheabilityOfRedirectResponses(): void {
        $this->assertCacheMaxAge(300);
        }
        }
        $this->getSession()->getDriver()->getClient()->followRedirects(TRUE);
        }
        /**
        * Tests that URLs are cached in a not normalized form.
        */
        public function testNoUrlNormalization(): void {
        protected function testNoUrlNormalization(): void {
        // Use absolute URLs to avoid any processing.
        $url = Url::fromRoute('<front>')->setAbsolute()->toString();
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment