diff -u b/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc --- b/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -230,7 +230,6 @@ $form['_account'] = array('#type' => 'value', '#value' => $account); // Display account cancellation method selection, if allowed. - $default_method = config('user.settings')->get('cancel_method'); $admin_access = user_access('administer users'); $can_select_method = $admin_access || user_access('select account cancellation method'); $form['user_cancel_method'] = array( @@ -365,14 +364,13 @@ drupal_alter('user_cancel_methods', $methods); // Turn all methods into real form elements. - $default_method = config('user.settings')->get('cancel_method') ?: 'user_cancel_block'; foreach ($methods as $name => $method) { $form[$name] = array( '#type' => 'radio', '#title' => $method['title'], '#description' => (isset($method['description']) ? $method['description'] : NULL), '#return_value' => $name, - '#default_value' => $default_method, + '#default_value' => config('user.settings')->get('cancel_method'), '#parents' => array('user_cancel_method'), ); } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php @@ -75,6 +75,32 @@ public function testSystemVariableUpgrade() { 'page.front' => 'node', ); + $this->checkExpectedConfig($expected_config); + } + + /** + * Tests upgrade of user variables. + */ + public function testUserVariableUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + $expected_config['user.settings'] = array( + 'cancel_method' => 'user_cancel_reassign', + ); + + $this->checkExpectedConfig($expected_config); + } + + /** + * Checks old variables have been upgraded to use config. + * + * @param array $expected_config + * An associative array, in the format: + * array('config.object_name' => array( + * 'variable_name' => 'expected_value'), + * ); + */ + protected function checkExpectedConfig(array $expected_config) { foreach ($expected_config as $file => $values) { $config = config($file); $this->verbose(print_r($config->get(), TRUE)); only in patch2: unchanged: --- a/core/modules/system/tests/upgrade/drupal-7.system.database.php +++ b/core/modules/system/tests/upgrade/drupal-7.system.database.php @@ -91,6 +91,10 @@ 'name' => 'site_slogan', 'value' => 's:31:"CMI makes Drupal 8 drush cex -y";', )) +->values(array( + 'name' => 'user_cancel_method', + 'value' => 's:20:"user_cancel_reassign"', +)) ->execute(); db_update('variable') only in patch2: unchanged: --- a/core/modules/user/config/user.settings.yml +++ b/core/modules/user/config/user.settings.yml @@ -12,3 +12,4 @@ notify: register_pending_approval: '1' register: visitors signatures: '0' +cancel_method: user_cancel_block