Commit 44920d2a authored by catch's avatar catch
Browse files

Issue #2990776 by tstoeckler, chr.fritsch: Remove config-editing parts from...

Issue #2990776 by tstoeckler, chr.fritsch: Remove config-editing parts from standard_install() in favor of exported configuration
parent 7e77a48c
definitions:
contact__site_page:
enabled: true
menu_name: footer
parent: ''
weight: 0
expanded: false
uuid: ''
name: ''
mail: ''
slogan: ''
page:
403: ''
404: ''
front: /node
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en
langcode: en
status: true
dependencies: { }
id: anonymous
label: 'Anonymous user'
weight: 0
is_admin: false
permissions:
- 'access comments'
- 'access content'
- 'access site-wide contact form'
- 'search content'
- 'use text format restricted_html'
langcode: en
status: true
dependencies: { }
id: authenticated
label: 'Authenticated user'
weight: 1
is_admin: false
permissions:
- 'access comments'
- 'access content'
- 'access shortcuts'
- 'access site-wide contact form'
- 'post comments'
- 'search content'
- 'skip comment approval'
- 'use text format basic_html'
anonymous: Anonymous
verify_mail: true
notify:
cancel_confirm: true
password_reset: true
status_activated: true
status_blocked: false
status_canceled: false
register_admin_created: true
register_no_approval_required: true
register_pending_approval: true
register: visitors_admin_approval
cancel_method: user_cancel_block
password_reset_timeout: 86400
password_strength: true
langcode: en
......@@ -6,7 +6,6 @@
*/
use Drupal\user\Entity\User;
use Drupal\user\RoleInterface;
use Drupal\shortcut\Entity\Shortcut;
/**
......@@ -17,17 +16,6 @@
* @see system_install()
*/
function standard_install() {
// Set front page to "node".
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE);
// Allow visitor account creation with administrative approval.
$user_settings = \Drupal::configFactory()->getEditable('user.settings');
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(TRUE);
// Enable default permissions for system roles.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access comments', 'post comments', 'skip comment approval']);
// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
......@@ -37,17 +25,6 @@ function standard_install() {
// menu links are valid.
\Drupal::service('router.builder')->rebuildIfNeeded();
// Enable the Contact link in the footer menu.
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$menu_link_manager->updateDefinition('contact.site_page', ['enabled' => TRUE]);
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access site-wide contact form']);
// Allow authenticated users to use shortcuts.
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access shortcuts']);
// Populate the default shortcut set.
$shortcut = Shortcut::create([
'shortcut_set' => 'default',
......@@ -64,11 +41,4 @@ function standard_install() {
'link' => ['uri' => 'internal:/admin/content'],
]);
$shortcut->save();
// Allow all users to use search.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['search content']);
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['search content']);
// Enable the admin theme.
\Drupal::configFactory()->getEditable('node.settings')->set('use_admin_theme', TRUE)->save(TRUE);
}
......@@ -50,8 +50,10 @@ protected function curlExec($curl_options, $redirect = FALSE) {
*/
public function testStandardConfig() {
$skipped_config = [];
// FunctionalTestSetupTrait::installParameters() uses
// simpletest@example.com as mail address.
// FunctionalTestSetupTrait::installParameters() uses Drupal as site name
// and simpletest@example.com as mail address.
$skipped_config['system.site'][] = 'name: Drupal';
$skipped_config['system.site'][] = 'mail: simpletest@example.com';
$skipped_config['contact.form.feedback'][] = '- simpletest@example.com';
// \Drupal\filter\Entity\FilterFormat::toArray() drops the roles of filter
// formats.
......@@ -61,6 +63,8 @@ public function testStandardConfig() {
$skipped_config['filter.format.full_html'][] = '- administrator';
$skipped_config['filter.format.restricted_html'][] = 'roles:';
$skipped_config['filter.format.restricted_html'][] = '- anonymous';
// The site UUID is set dynamically for each installation.
$skipped_config['system.site'][] = 'uuid: ' . $this->config('system.site')->get('uuid');
$this->assertInstalledConfig($skipped_config);
}
......
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