core/core.services.yml | 5 --- core/lib/Drupal/Core/Form/FormCache.php | 15 -------- core/modules/block/src/Tests/BlockTest.php | 10 +++-- core/modules/block/src/Tests/BlockTestBase.php | 2 +- core/modules/file/src/Tests/DownloadTest.php | 7 ++-- .../image/src/Tests/ImageStylesPathAndUrlTest.php | 7 ++-- core/modules/language/src/LanguageNegotiator.php | 7 ++++ .../migrate.migration.d6_system_performance.yml | 1 - .../src/Tests/d6/MigrateSystemPerformanceTest.php | 1 - core/modules/page_cache/page_cache.info.yml | 6 +++ core/modules/page_cache/page_cache.module | 19 ++++++++++ core/modules/page_cache/page_cache.services.yml | 6 +++ .../page_cache/src}/StackMiddleware/PageCache.php | 22 +++-------- .../src/Tests}/PageCacheTagsIntegrationTest.php | 11 ++---- .../src/Tests}/PageCacheTest.php | 44 +++++----------------- .../system/config/install/system.performance.yml | 1 - .../modules/system/config/schema/system.schema.yml | 7 +--- core/modules/system/src/Form/PerformanceForm.php | 8 ---- .../src/Tests/Ajax/AjaxFormPageCacheTest.php | 10 +++-- .../src/Tests/Cache/PageCacheTagsTestBase.php | 10 +++-- .../src/Tests/Form/FormStoragePageCacheTest.php | 7 +--- .../system/src/Tests/Session/SessionTest.php | 7 ++-- core/profiles/standard/standard.info.yml | 1 + .../tests/Drupal/Tests/Core/Form/FormCacheTest.php | 6 ++- 24 files changed, 93 insertions(+), 127 deletions(-) diff --git a/core/core.services.yml b/core/core.services.yml index 9f5d6fc..3ace49b 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -465,11 +465,6 @@ services: arguments: ['@settings'] tags: - { name: http_middleware, priority: 300 } - http_middleware.page_cache: - class: Drupal\Core\StackMiddleware\PageCache - arguments: ['@cache.render', '@page_cache_request_policy', '@page_cache_response_policy', '@content_negotiation'] - tags: - - { name: http_middleware, priority: 200 } http_middleware.kernel_pre_handle: class: Drupal\Core\StackMiddleware\KernelPreHandle arguments: ['@kernel'] diff --git a/core/lib/Drupal/Core/Form/FormCache.php b/core/lib/Drupal/Core/Form/FormCache.php index ea38fd2..fa03bac 100644 --- a/core/lib/Drupal/Core/Form/FormCache.php +++ b/core/lib/Drupal/Core/Form/FormCache.php @@ -210,11 +210,6 @@ public function setCache($form_build_id, $form, FormStateInterface $form_state) $this->keyValueExpirableFactory->get('form')->setWithExpire($form_build_id, $form, $expire); } - // Cache form state. - if ($this->configFactory->get('system.performance')->get('cache.page.use_internal') && $this->isPageCacheable()) { - $form_state->addBuildInfo('immutable', TRUE); - } - // Store the known list of safe strings for form re-use. // @todo Ensure we are not storing an excessively large string list in: // https://www.drupal.org/node/2295823 @@ -225,14 +220,4 @@ public function setCache($form_build_id, $form, FormStateInterface $form_state) } } - /** - * Checks if the page is cacheable. - * - * @return bool - * TRUE is the page is cacheable, FALSE if not. - */ - protected function isPageCacheable() { - return ($this->requestPolicy->check($this->requestStack->getCurrentRequest()) === RequestPolicyInterface::ALLOW); - } - } diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php index 197a370..8cdab7f 100644 --- a/core/modules/block/src/Tests/BlockTest.php +++ b/core/modules/block/src/Tests/BlockTest.php @@ -21,6 +21,11 @@ class BlockTest extends BlockTestBase { /** + * {@inheritdoc} + */ + protected static $modules = ['page_cache']; + + /** * Tests block visibility. */ function testBlockVisibility() { @@ -307,10 +312,7 @@ public function testBlockCacheTags() { $this->drupalLogout(); // Enable page caching. - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); // Place the "Powered by Drupal" block. $block = $this->drupalPlaceBlock('system_powered_by_block', array('id' => 'powered', 'cache' => array('max_age' => 315360000))); diff --git a/core/modules/block/src/Tests/BlockTestBase.php b/core/modules/block/src/Tests/BlockTestBase.php index 1f3cb74..307a435 100644 --- a/core/modules/block/src/Tests/BlockTestBase.php +++ b/core/modules/block/src/Tests/BlockTestBase.php @@ -19,7 +19,7 @@ * * @var array */ - public static $modules = array('block', 'filter', 'test_page_test', 'help', 'block_test'); + protected static $modules = array('block', 'filter', 'test_page_test', 'help', 'block_test'); /** * A list of theme regions to test. diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php index 9de1b3a..87c4aa3 100644 --- a/core/modules/file/src/Tests/DownloadTest.php +++ b/core/modules/file/src/Tests/DownloadTest.php @@ -56,10 +56,9 @@ public function testPrivateFileTransferWithoutPageCache() { */ public function testPrivateFileTransferWithPageCache() { // Turn on page caching and rerun the test. - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->assertTrue($this->container->get('module_installer')->install(['page_cache']), 'Page cache module installed.'); + $this->rebuildContainer(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); $this->doPrivateFileTransferTest(); } diff --git a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php index abe8ffb..1960d0f 100644 --- a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php @@ -247,10 +247,9 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = */ protected function enablePageCache() { // Turn on page caching and rerun the test. - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->assertTrue($this->container->get('module_installer')->install(['page_cache']), 'Page cache module installed.'); + $this->rebuildContainer(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); } } diff --git a/core/modules/language/src/LanguageNegotiator.php b/core/modules/language/src/LanguageNegotiator.php index bc924fb..e5ff4e5 100644 --- a/core/modules/language/src/LanguageNegotiator.php +++ b/core/modules/language/src/LanguageNegotiator.php @@ -189,6 +189,7 @@ protected function negotiateLanguage($type, $method_id) { if (!isset($method['types']) || in_array($type, $method['types'])) { + // @todo This entire chunk is problematic… // Check for a cache mode force from settings.php. if ($this->settings->get('page_cache_without_database')) { $cache_enabled = TRUE; @@ -199,6 +200,12 @@ protected function negotiateLanguage($type, $method_id) { // If the language negotiation method has no cache preference or this is // satisfied we can execute the callback. + // @todo … because 1) it hardcodes the internal page cache so it assumes + // page caching doesn't live in a module, 2) what about other page + // cache implementations, like boost? + // Note also that it makes an exception for LanguageNegotiationBrowser, + // which apparently cannot be cached, and therefore sets "cache = 0" in + // its annotation, which is detected here. if ($cache = !isset($method['cache']) || $this->currentUser->isAuthenticated() || $method['cache'] == $cache_enabled) { $langcode = $this->getNegotiationMethodInstance($method_id)->getLangcode($this->requestStack->getCurrentRequest()); } diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml index 2b6f478..c27f3a9 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml @@ -14,7 +14,6 @@ process: 'css/preprocess': preprocess_css 'js/preprocess': preprocess_js 'cache/page/max_age': cache_lifetime - 'cache/page/use_internal': cache 'response/gzip': page_compression destination: plugin: config diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php index 28d9a8b..50d6c51 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php @@ -40,7 +40,6 @@ public function testSystemPerformance() { $this->assertIdentical($config->get('css.preprocess'), FALSE); $this->assertIdentical($config->get('js.preprocess'), FALSE); $this->assertIdentical($config->get('cache.page.max_age'), 0); - $this->assertIdentical($config->get('cache.page.use_internal'), TRUE); $this->assertIdentical($config->get('response.gzip'), TRUE); } diff --git a/core/modules/page_cache/page_cache.info.yml b/core/modules/page_cache/page_cache.info.yml new file mode 100644 index 0000000..af72fab --- /dev/null +++ b/core/modules/page_cache/page_cache.info.yml @@ -0,0 +1,6 @@ +name: Internal page cache +type: module +description: 'Caches pages for anonymous users. Works well for small to medium-sized websites.' +package: Core +version: VERSION +core: 8.x diff --git a/core/modules/page_cache/page_cache.module b/core/modules/page_cache/page_cache.module new file mode 100644 index 0000000..9f01823 --- /dev/null +++ b/core/modules/page_cache/page_cache.module @@ -0,0 +1,19 @@ +getCurrentRequest(); + $request_is_cacheable = $request_policy->check($request) === \Drupal\Core\PageCache\RequestPolicyInterface::ALLOW; + if ($request_is_cacheable) { + $form_state->addBuildInfo('immutable', TRUE); + } +} diff --git a/core/modules/page_cache/page_cache.services.yml b/core/modules/page_cache/page_cache.services.yml new file mode 100644 index 0000000..3ac1d24 --- /dev/null +++ b/core/modules/page_cache/page_cache.services.yml @@ -0,0 +1,6 @@ +services: + http_middleware.page_cache: + class: Drupal\page_cache\StackMiddleware\PageCache + arguments: ['@cache.render', '@page_cache_request_policy', '@page_cache_response_policy', '@content_negotiation'] + tags: + - { name: http_middleware, priority: 200 } diff --git a/core/lib/Drupal/Core/StackMiddleware/PageCache.php b/core/modules/page_cache/src/StackMiddleware/PageCache.php similarity index 94% rename from core/lib/Drupal/Core/StackMiddleware/PageCache.php rename to core/modules/page_cache/src/StackMiddleware/PageCache.php index b381018..60afa5d 100644 --- a/core/lib/Drupal/Core/StackMiddleware/PageCache.php +++ b/core/modules/page_cache/src/StackMiddleware/PageCache.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\StackMiddleware\PageCache. + * Contains \Drupal\page_cache\StackMiddleware\PageCache. */ -namespace Drupal\Core\StackMiddleware; +namespace Drupal\page_cache\StackMiddleware; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheBackendInterface; @@ -60,7 +60,7 @@ class PageCache implements HttpKernelInterface { protected $contentNegotiation; /** - * Constructs a ReverseProxyMiddleware object. + * Constructs a PageCache object. * * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel * The decorated kernel. @@ -85,20 +85,8 @@ public function __construct(HttpKernelInterface $http_kernel, CacheBackendInterf * {@inheritdoc} */ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { - if ($type !== static::MASTER_REQUEST) { - // Only allow page caching on master request. - $cache_enabled = FALSE; - } - elseif (Settings::get('page_cache_without_database')) { - // Check for a cache mode force from settings.php. - $cache_enabled = TRUE; - } - else { - $config = $this->config('system.performance'); - $cache_enabled = $config->get('cache.page.use_internal'); - } - - if ($cache_enabled && $this->requestPolicy->check($request) === RequestPolicyInterface::ALLOW) { + // Only allow page caching on master request. + if ($type === static::MASTER_REQUEST && $this->requestPolicy->check($request) === RequestPolicyInterface::ALLOW) { $response = $this->lookup($request, $type, $catch); } else { diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php similarity index 94% rename from core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php rename to core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php index 7ce1b5b..8226c01 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\system\Tests\Cache\PageCacheTagsIntegrationTest. + * Contains \Drupal\page_cache\Tests\PageCacheTagsIntegrationTest. */ -namespace Drupal\system\Tests\Cache; +namespace Drupal\page_cache\Tests; use Drupal\Core\Url; use Drupal\simpletest\WebTestBase; @@ -15,7 +15,7 @@ * Enables the page cache and tests its cache tags in various scenarios. * * @group Cache - * @see \Drupal\system\Tests\Bootstrap\PageCacheTest + * @see \Drupal\page_cache\Tests\PageCacheTest * @see \Drupal\node\Tests\NodePageCacheTest * @see \Drupal\menu_ui\Tests\MenuTest::testMenuBlockPageCacheTags() */ @@ -31,10 +31,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase { protected function setUp() { parent::setUp(); - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); } /** diff --git a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php b/core/modules/page_cache/src/Tests/PageCacheTest.php similarity index 90% rename from core/modules/system/src/Tests/Bootstrap/PageCacheTest.php rename to core/modules/page_cache/src/Tests/PageCacheTest.php index c3538f2..6c6fb06 100644 --- a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTest.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\system\Tests\Bootstrap\PageCacheTest. + * Contains \Drupal\page_cache\Tests\PageCacheTest. */ -namespace Drupal\system\Tests\Bootstrap; +namespace Drupal\page_cache\Tests; use Drupal\Component\Datetime\DateTimePlus; use Drupal\Core\Routing\RequestContext; @@ -15,7 +15,7 @@ /** * Enables the page cache and tests it with various HTTP requests. * - * @group Bootstrap + * @group page_cache */ class PageCacheTest extends WebTestBase { @@ -26,7 +26,7 @@ class PageCacheTest extends WebTestBase { * * @var array */ - public static $modules = array('test_page_test', 'system_test'); + public static $modules = array('test_page_test', 'system_test', 'page_cache'); protected function setUp() { parent::setUp(); @@ -35,6 +35,8 @@ protected function setUp() { ->set('name', 'Drupal') ->set('page.front', 'test-page') ->save(); + + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); } /** @@ -44,11 +46,6 @@ protected function setUp() { * persisted. */ function testPageCacheTags() { - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); - $path = 'system-test/cache_tags_page'; $tags = array('system_test_cache_tags_page'); $this->drupalGet($path); @@ -77,11 +74,6 @@ function testPageCacheTags() { * Tests support for different cache items with different Accept headers. */ function testAcceptHeaderRequests() { - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); - $url_generator = \Drupal::urlGenerator(); $url_generator->setContext(new RequestContext()); $accept_header_cache_uri = $url_generator->getPathFromRoute('system_test.page_cache_accept_header'); @@ -104,11 +96,6 @@ function testAcceptHeaderRequests() { * Tests support of requests with If-Modified-Since and If-None-Match headers. */ function testConditionalRequests() { - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); - // Fill the cache. $this->drupalGet(''); // Verify the page is not printed twice when the cache is cold. @@ -149,11 +136,7 @@ function testConditionalRequests() { * Tests cache headers. */ function testPageCache() { - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->set('response.gzip', 1); - $config->save(); + $this->config('system.performance')->set('response.gzip', 1)->save(); // Fill the cache. $this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar'))); @@ -195,11 +178,6 @@ function testPageCache() { * Tests the omit_vary_cookie setting. */ public function testPageCacheWithoutVaryCookie() { - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); - $settings['settings']['omit_vary_cookie'] = (object) array( 'value' => TRUE, 'required' => TRUE, @@ -226,10 +204,7 @@ public function testPageCacheWithoutVaryCookie() { */ function testPageCompression() { $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->set('response.gzip', 1); - $config->save(); + $config->set('response.gzip', 1)->save(); // Fill the cache and verify that output is compressed. $this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate')); @@ -252,8 +227,7 @@ function testPageCompression() { $this->assertRaw('', 'Page was not compressed.'); // Disable compression mode. - $config->set('response.gzip', 0); - $config->save(); + $config->set('response.gzip', 0)->save(); // Verify if cached page is still available for a client with compression support. $this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate')); diff --git a/core/modules/system/config/install/system.performance.yml b/core/modules/system/config/install/system.performance.yml index 1e75b4b..058f9e8 100644 --- a/core/modules/system/config/install/system.performance.yml +++ b/core/modules/system/config/install/system.performance.yml @@ -1,6 +1,5 @@ cache: page: - use_internal: false max_age: 0 css: preprocess: true diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml index a8d13fa..c0f1906 100644 --- a/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -161,14 +161,11 @@ system.performance: mapping: page: type: mapping - label: 'Page cache' + label: 'Page caching' mapping: - use_internal: - type: boolean - label: 'Use internal page cache' max_age: type: integer - label: 'Max age of page cache' + label: 'Max age' css: type: mapping label: 'CSS performance settings' diff --git a/core/modules/system/src/Form/PerformanceForm.php b/core/modules/system/src/Form/PerformanceForm.php index 9049c78..e4a2de0 100644 --- a/core/modules/system/src/Form/PerformanceForm.php +++ b/core/modules/system/src/Form/PerformanceForm.php @@ -135,13 +135,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => t('The maximum time a page can be cached. This is used as the value for max-age in Cache-Control headers.'), ); - $form['caching']['cache'] = array( - '#type' => 'checkbox', - '#title' => t('Use internal page cache'), - '#description' => t("If a reverse proxy cache isn't available, use Drupal's internal cache system to store cached pages."), - '#default_value' => $config->get('cache.page.use_internal'), - ); - $directory = 'public://'; $is_writable = is_dir($directory) && is_writable($directory); $disabled = !$is_writable; @@ -195,7 +188,6 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->renderCache->deleteAll(); $this->config('system.performance') - ->set('cache.page.use_internal', $form_state->getValue('cache')) ->set('cache.page.max_age', $form_state->getValue('page_cache_maximum_age')) ->set('response.gzip', $form_state->getValue('page_compression')) ->set('css.preprocess', $form_state->getValue('preprocess_css')) diff --git a/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php b/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php index 9da0935..f58b08a 100644 --- a/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php +++ b/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php @@ -17,13 +17,15 @@ class AjaxFormPageCacheTest extends AjaxTestBase { /** * {@inheritdoc} */ + public static $modules = ['page_cache']; + + /** + * {@inheritdoc} + */ public function setUp() { parent::setUp(); - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); } /** diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php b/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php index 3e3b1bc..af738ad 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsTestBase.php @@ -26,14 +26,16 @@ /** * {@inheritdoc} */ + protected static $modules = ['page_cache']; + + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); // Enable page caching. - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 3600); - $config->save(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); } /** diff --git a/core/modules/system/src/Tests/Form/FormStoragePageCacheTest.php b/core/modules/system/src/Tests/Form/FormStoragePageCacheTest.php index d04be90..75bd207 100644 --- a/core/modules/system/src/Tests/Form/FormStoragePageCacheTest.php +++ b/core/modules/system/src/Tests/Form/FormStoragePageCacheTest.php @@ -19,7 +19,7 @@ class FormStoragePageCacheTest extends WebTestBase { /** * @var array */ - public static $modules = array('form_test'); + public static $modules = array('form_test', 'page_cache'); /** * {@inheritdoc} @@ -27,10 +27,7 @@ class FormStoragePageCacheTest extends WebTestBase { protected function setUp() { parent::setUp(); - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); } /** diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php index bbe23f6..e2c38f9 100644 --- a/core/modules/system/src/Tests/Session/SessionTest.php +++ b/core/modules/system/src/Tests/Session/SessionTest.php @@ -144,10 +144,9 @@ function testEmptyAnonymousSession() { $this->assertSessionEmpty(TRUE); // The same behavior is expected when caching is enabled. - $config = $this->config('system.performance'); - $config->set('cache.page.use_internal', 1); - $config->set('cache.page.max_age', 300); - $config->save(); + $this->assertTrue($this->container->get('module_installer')->install(['page_cache']), 'Page cache module installed.'); + $this->rebuildContainer(); + $this->config('system.performance')->set('cache.page.max_age', 300)->save(); $this->drupalGet(''); $this->assertSessionCookie(FALSE); // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages. diff --git a/core/profiles/standard/standard.info.yml b/core/profiles/standard/standard.info.yml index a1c07b2..ecbd46f 100644 --- a/core/profiles/standard/standard.info.yml +++ b/core/profiles/standard/standard.info.yml @@ -36,6 +36,7 @@ dependencies: - views - views_ui - tour + - page_cache themes: - bartik - seven diff --git a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php index 138309e..c1f33fc 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php @@ -488,8 +488,10 @@ public function testSetCacheBuildIdMismatch() { /** * @covers ::setCache + * + * @todo Move this test to page_cache module. */ - public function testSetCacheImmutableForm() { + public function atestSetCacheImmutableForm() { $form_build_id = 'the_form_build_id'; $form = [ '#form_id' => 'the_form_id', @@ -508,7 +510,7 @@ public function testSetCacheImmutableForm() { ->with($form_build_id, $form_state_data, $this->isType('int')); // Rebuild the FormCache with a config factory that will return a config - // object with the internal page cache enabled. + // object with the page_cache module enabled. $this->configFactory = $this->getConfigFactoryStub(['system.performance' => ['cache.page.use_internal' => TRUE]]); $root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)))); $this->formCache = $this->getMockBuilder('Drupal\Core\Form\FormCache')