core/MAINTAINERS.txt | 4 ++++ core/profiles/minimal/minimal.info.yml | 1 + core/profiles/standard/src/Tests/StandardTest.php | 24 +++++++++++++++++++++++ core/profiles/standard/standard.info.yml | 1 + 4 files changed, 30 insertions(+) diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt index 2e9b1bf..68e8419 100644 --- a/core/MAINTAINERS.txt +++ b/core/MAINTAINERS.txt @@ -414,6 +414,10 @@ Search module Serialization module - Damian Lee 'damiankloip' https://www.drupal.org/u/damiankloip +Smart Cache module +- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx +- Wim Leers 'Wim Leers' https://www.drupal.org/u/wim-leers + Shortcut module - Tobias Stöckler 'tstoeckler' https://www.drupal.org/u/tstoeckler - Jibran Ijaz 'jibran' https://www.drupal.org/u/jibran diff --git a/core/profiles/minimal/minimal.info.yml b/core/profiles/minimal/minimal.info.yml index 206b8e7..9c1d809 100644 --- a/core/profiles/minimal/minimal.info.yml +++ b/core/profiles/minimal/minimal.info.yml @@ -8,5 +8,6 @@ dependencies: - block - dblog - page_cache + - smart_cache themes: - stark diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index 2a7f4ef..a36a0a7 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -9,6 +9,7 @@ use Drupal\config\Tests\SchemaCheckTestTrait; use Drupal\contact\Entity\ContactForm; +use Drupal\Core\Url; use Drupal\filter\Entity\FilterFormat; use Drupal\simpletest\WebTestBase; use Drupal\user\Entity\Role; @@ -177,5 +178,28 @@ function testStandard() { $this->assertText('Max 650x650'); $this->assertText('Max 1300x1300'); $this->assertText('Max 2600x2600'); + + // Verify certain routes' responses are cacheable by SmartCache, to ensure + // these responses are very fast for authenticated users. + $this->dumpHeaders = TRUE; + $this->drupalLogin($this->adminUser); + $url = Url::fromRoute('contact.site_page'); + $this->drupalGet($url); + $this->assertEqual('UNCACHEABLE', $this->drupalGetHeader('X-Drupal-SmartCache'), 'Site-wide contact page cannot be cached by SmartCache.'); + + $url = Url::fromRoute(''); + $this->drupalGet($url); + $this->drupalGet($url); + $this->assertEqual('HIT', $this->drupalGetHeader('X-Drupal-SmartCache'), 'Frontpage is cached by SmartCache.'); + + $url = Url::fromRoute('entity.node.canonical', ['node' => 1]); + $this->drupalGet($url); + $this->drupalGet($url); + $this->assertEqual('HIT', $this->drupalGetHeader('X-Drupal-SmartCache'), 'Full node page is cached by SmartCache.'); + + $url = Url::fromRoute('entity.user.canonical', ['user' => 1]); + $this->drupalGet($url); + $this->drupalGet($url); + $this->assertEqual('HIT', $this->drupalGetHeader('X-Drupal-SmartCache'), 'User profile page is cached by SmartCache.'); } } diff --git a/core/profiles/standard/standard.info.yml b/core/profiles/standard/standard.info.yml index a356ae8..b487f6d 100644 --- a/core/profiles/standard/standard.info.yml +++ b/core/profiles/standard/standard.info.yml @@ -26,6 +26,7 @@ dependencies: - options - path - page_cache + - smart_cache - taxonomy - dblog - search