Commit 3a8dd52c authored by Dries's avatar Dries

Issue #2226761 by Wim Leers: Change all default settings and config to fast/safe production values.

parent f715886f
......@@ -27,6 +27,10 @@ services:
arguments: ['@database']
cache.backend.php:
class: Drupal\Core\Cache\PhpBackendFactory
cache.backend.memory:
class: Drupal\Core\Cache\MemoryBackendFactory
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
cache.bootstrap:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
......
<?php
/**
* @file
* Contains \Drupal\Core\Cache\NullBackendFactory.
*/
namespace Drupal\Core\Cache;
class NullBackendFactory implements CacheFactoryInterface {
/**
* {@inheritdoc}
*/
function get($bin) {
return new NullBackend($bin);
}
}
......@@ -89,6 +89,11 @@ function setUp() {
'123456' => FALSE,
'#00000g' => FALSE,
);
// Turn off CSS aggregation.
\Drupal::config('system.performance')
->set('css.preprocess', FALSE)
->save();
}
/**
......
......@@ -67,7 +67,7 @@ public function testHelp() {
// Check for css on admin/help.
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/help');
$this->assertRaw(drupal_get_path('module', 'help') . '/css/help.module.css', 'The help.module.css file is present in the HTML.');
$this->assertRaw('help.module.css', 'The help.module.css file is present in the HTML.');
// Verify that introductory help text exists, goes for 100% module coverage.
$this->assertRaw(t('For more information, refer to the subjects listed in the Help Topics section or to the <a href="!docs">online documentation</a> and <a href="!support">support</a> pages at <a href="!drupal">drupal.org</a>.', array('!docs' => 'https://drupal.org/documentation', '!support' => 'https://drupal.org/support', '!drupal' => 'https://drupal.org')), 'Help intro text correctly appears.');
......
......@@ -176,8 +176,7 @@ public function testUserWithPermission() {
$this->assertIdentical('settings', $ajax_commands[0]['command'], 'The first AJAX command is a settings command.');
// Second command: insert libraries into DOM.
$this->assertIdentical('insert', $ajax_commands[1]['command'], 'The second AJAX command is an append command.');
$command = new AppendCommand('body', '<script src="' . file_create_url('core/modules/quickedit/js/editors/formEditor.js') . '?v=' . \Drupal::VERSION . '"></script>' . "\n");
$this->assertIdentical($command->render(), $ajax_commands[1], 'The append command contains the expected data.');
$this->assertTrue(in_array('core/modules/quickedit/js/editors/formEditor.js', array_keys($ajax_commands[0]['settings']['ajaxPageState']['js'])), 'The quickedit.inPlaceEditor.form library is loaded.');
// Retrieving the form for this field should result in a 200 response,
// containing only a quickeditFieldForm command.
......
......@@ -887,6 +887,11 @@ protected function setUp() {
->set('interface.default', 'test_mail_collector')
->save();
// Ensure errors are displayed.
\Drupal::config('system.logging')
->set('error_level', 'all')
->save();
// Restore the original Simpletest batch.
$batch = &batch_get();
$batch = $this->originalBatch;
......
......@@ -72,7 +72,7 @@ function testLogging() {
$path = 'node/' . $this->node->id();
$module_path = drupal_get_path('module', 'statistics');
$stats_path = $base_url . '/' . $module_path . '/statistics.php';
$expected_library = $module_path . '/statistics.js';
$expected_library = str_replace('/', '\/', $module_path . '/statistics.js');
$expected_settings = '"statistics":{"data":{"nid":"' . $this->node->id() . '"}';
// Verify that logging scripts are not found on a non-node page.
......
......@@ -3,7 +3,7 @@ cache:
use_internal: false
max_age: 0
css:
preprocess: false
preprocess: true
gzip: true
fast_404:
enabled: true
......@@ -11,7 +11,7 @@ fast_404:
exclude_paths: '/\/(?:styles|imagecache)\//'
html: '<!DOCTYPE html><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>'
js:
preprocess: false
preprocess: true
gzip: true
response:
gzip: false
......
......@@ -88,6 +88,14 @@ public function batchPage(Request $request) {
$page = element_info('page');
$page['#show_messages'] = FALSE;
// @todo For some reason, _drupal_bootstrap_code()'s call to
// file_get_stream_wrappers() to register all stream wrappers is
// insufficient in the case of the no-JS version of the batch page:
// checking if a needed CSS aggregate already exists in the file system
// will fail unless we re-register the stream wrappers here! This may be
// a PHP bug.
file_get_stream_wrappers();
$page = $this->render($page);
return $page;
......
......@@ -143,12 +143,9 @@ public function testDialog() {
$ajax_result = $this->drupalPostAjaxForm('ajax-test/dialog', array(), 'button1');
// Check that CSS and JavaScript are "added" to the page dynamically.
$dialog_css_exists = strpos($ajax_result[1]['data'], 'jquery.ui.dialog.css') !== FALSE;
$this->assertTrue($dialog_css_exists, 'jQuery UI dialog CSS added to the page.');
$dialog_js_exists = strpos($ajax_result[2]['data'], 'jquery.ui.dialog.js') !== FALSE;
$this->assertTrue($dialog_js_exists, 'jQuery UI dialog JS added to the page.');
$dialog_js_exists = strpos($ajax_result[2]['data'], 'dialog.ajax.js') !== FALSE;
$this->assertTrue($dialog_js_exists, 'Drupal dialog JS added to the page.');
$this->assertTrue(in_array('jquery.ui.dialog.css', array_keys($ajax_result[0]['settings']['ajaxPageState']['css'])), 'jQuery UI dialog CSS added to the page.');
$this->assertTrue(in_array('core/assets/vendor/jquery.ui/ui/jquery.ui.dialog.js', array_keys($ajax_result[0]['settings']['ajaxPageState']['js'])), 'jQuery UI dialog JS added to the page.');
$this->assertTrue(in_array('core/misc/dialog.ajax.js', array_keys($ajax_result[0]['settings']['ajaxPageState']['js'])), 'Drupal dialog JS added to the page.');
// Check that the response matches the expected value.
$this->assertEqual($modal_expected_response, $ajax_result[3], 'POST request modal dialog JSON response matches.');
......
......@@ -29,6 +29,11 @@ protected function setUp() {
// Grant the anonymous user the permission to look at user profiles.
user_role_grant_permissions('anonymous', array('access user profiles'));
// Turn off JS aggregation.
\Drupal::config('system.performance')
->set('js.preprocess', FALSE)
->save();
}
/**
......
......@@ -43,6 +43,11 @@ function setUp() {
* Otherwise, collapse.js adds "SHOW" or "HIDE" labels to the tabs.
*/
function testJavaScriptOrdering() {
// Turn off JS aggregation.
\Drupal::config('system.performance')
->set('js.preprocess', FALSE)
->save();
$this->drupalGet('form_test/vertical-tabs');
$position1 = strpos($this->content, 'core/misc/vertical-tabs.js');
$position2 = strpos($this->content, 'core/misc/collapse.js');
......
......@@ -47,6 +47,11 @@ function setUp() {
// Enable dummy module that implements hook_menu.
parent::setUp();
// Turn off CSS aggregation.
\Drupal::config('system.performance')
->set('css.preprocess', FALSE)
->save();
$this->drupalPlaceBlock('system_menu_block:tools');
}
......
......@@ -186,6 +186,11 @@ function testThemeSettings() {
function testAdministrationTheme() {
$this->container->get('theme_handler')->enable(array('seven'));
// Turn off CSS aggregation.
\Drupal::config('system.performance')
->set('css.preprocess', FALSE)
->save();
// Enable an administration theme and show it on the node admin pages.
$edit = array(
'admin_theme' => 'seven',
......
......@@ -29,6 +29,18 @@ public static function getInfo() {
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Turn off CSS aggregation.
\Drupal::config('system.performance')
->set('css.preprocess', FALSE)
->save();
}
/**
* Test that the theme system can generate output in a request listener.
*/
......
......@@ -29,6 +29,18 @@ public static function getInfo() {
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Turn off CSS aggregation.
\Drupal::config('system.performance')
->set('css.preprocess', FALSE)
->save();
}
/**
* Tests stylesheets-override and stylesheets-remove.
*/
......
......@@ -31,6 +31,11 @@ function setUp() {
->set('admin', 'seven')
->save();
// Turn off CSS aggregation.
\Drupal::config('system.performance')
->set('css.preprocess', FALSE)
->save();
// Create and log in as a user who has permission to add and edit taxonomy
// terms and view the administrative theme.
$admin_user = $this->drupalCreateUser(array('administer taxonomy', 'view the administration theme'));
......
......@@ -275,59 +275,6 @@
*/
$settings['update_free_access'] = FALSE;
/**
* Twig debugging:
*
* When debugging is enabled:
* - The markup of each Twig template is surrounded by HTML comments that
* contain theming information, such as template file name suggestions.
* - Note that this debugging markup will cause automated tests that directly
* check rendered HTML to fail. When running automated tests, 'twig_debug'
* should be set to FALSE.
* - The dump() function can be used in Twig templates to output information
* about template variables.
* - Twig templates are automatically recompiled whenever the source code
* changes (see twig_auto_reload below).
*
* Note: changes to this setting will only take effect once the cache is
* cleared.
*
* For more information about debugging Twig templates, see
* http://drupal.org/node/1906392.
*
* Not recommended in production environments (Default: FALSE).
*/
# $settings['twig_debug'] = TRUE;
/**
* Twig auto-reload:
*
* Automatically recompile Twig templates whenever the source code changes. If
* you don't provide a value for twig_auto_reload, it will be determined based
* on the value of twig_debug.
*
* Note: changes to this setting will only take effect once the cache is
* cleared.
*
* Not recommended in production environments (Default: NULL).
*/
# $settings['twig_auto_reload'] = TRUE;
/**
* Twig cache:
*
* By default, Twig templates will be compiled and stored in the filesystem to
* increase performance. Disabling the Twig cache will recompile the templates
* from source each time they are used. In most cases the twig_auto_reload
* setting above should be enabled rather than disabling the Twig cache.
*
* Note: changes to this setting will only take effect once the cache is
* cleared.
*
* Not recommended in production environments (Default: TRUE).
*/
# $settings['twig_cache'] = FALSE;
/**
* External access proxy settings:
*
......@@ -510,16 +457,6 @@
*/
# $settings['maintenance_theme'] = 'bartik';
/**
* Enable access to rebuild.php.
*
* This setting can be enabled to allow Drupal's php and database cached
* storage to be cleared via the rebuild.php page. Access to this page can also
* be gained by generating a query string from rebuild_token_calculator.sh and
* using these parameters in a request to rebuild.php.
*/
# $settings['rebuild_access'] = TRUE;
/**
* Base URL (optional).
*
......
<?php
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/yoursite.com/settings.local.php'. Then, go to the bottom
* of 'sites/yoursite.com/settings.php' and uncomment the commented lines that
* mention 'settings.local.php'.
*/
// Show all error messages, with backtrace information.
$config['system.logging']['error_level'] = 'verbose';
// Disable CSS and JS aggregation.
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
// Disable the render cache, by using the Null cache back-end.
$settings['cache']['bins']['render'] = 'cache.backend.null';
/**
* Enable access to rebuild.php.
*
* This setting can be enabled to allow Drupal's php and database cached
* storage to be cleared via the rebuild.php page. Access to this page can also
* be gained by generating a query string from rebuild_token_calculator.sh and
* using these parameters in a request to rebuild.php.
*/
$settings['rebuild_access'] = TRUE;
/**
* Twig debugging:
*
* When debugging is enabled:
* - The markup of each Twig template is surrounded by HTML comments that
* contain theming information, such as template file name suggestions.
* - Note that this debugging markup will cause automated tests that directly
* check rendered HTML to fail. When running automated tests, 'twig_debug'
* should be set to FALSE.
* - The dump() function can be used in Twig templates to output information
* about template variables.
* - Twig templates are automatically recompiled whenever the source code
* changes (see twig_auto_reload below).
*
* Note: changes to this setting will only take effect once the cache is
* cleared.
*
* For more information about debugging Twig templates, see
* http://drupal.org/node/1906392.
*
* Not recommended in production environments (Default: FALSE).
*/
# $settings['twig_debug'] = TRUE;
/**
* Twig auto-reload:
*
* Automatically recompile Twig templates whenever the source code changes. If
* you don't provide a value for twig_auto_reload, it will be determined based
* on the value of twig_debug.
*
* Note: changes to this setting will only take effect once the cache is
* cleared.
*
* Not recommended in production environments (Default: NULL).
*/
# $settings['twig_auto_reload'] = TRUE;
/**
* Twig cache:
*
* By default, Twig templates will be compiled and stored in the filesystem to
* increase performance. Disabling the Twig cache will recompile the templates
* from source each time they are used. In most cases the twig_auto_reload
* setting above should be enabled rather than disabling the Twig cache.
*
* Note: changes to this setting will only take effect once the cache is
* cleared.
*
* Not recommended in production environments (Default: TRUE).
*/
# $settings['twig_cache'] = FALSE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment