Commit 87f01f06 authored by alexpott's avatar alexpott

Issue #1924992 by tim.plunkett, kim.pepper, damiankloip, amateescu: Convert...

Issue #1924992 by tim.plunkett, kim.pepper, damiankloip, amateescu: Convert user's system_config_form() to SystemConfigFormBase.
parent c44404a3
......@@ -33,7 +33,7 @@ public static function getInfo() {
protected function setUp() {
parent::setUp();
$this->form_id = new FormTestObject();
$this->form = new FormTestObject();
$this->values = array(
'bananas' => array(
'#value' => $this->randomString(10),
......
......@@ -19,9 +19,9 @@ abstract class SystemConfigFormTestBase extends WebTestBase {
/**
* Form ID to use for testing.
*
* @var string
* @var \Drupal\Core\Form\FormInterface.
*/
protected $form_id;
protected $form;
/**
* Values to use for testing.
......@@ -45,13 +45,13 @@ abstract class SystemConfigFormTestBase extends WebTestBase {
/**
* Submit the system_config_form ensure the configuration has expected values.
*/
function testConfigForm() {
public function testConfigForm() {
// Programmatically submit the given values.
foreach ($this->values as $form_key => $data) {
$values[$form_key] = $data['#value'];
}
$form_state = array('values' => $values);
drupal_form_submit($this->form_id, $form_state);
drupal_form_submit($this->form, $form_state);
// Check that the form returns an error when expected, and vice versa.
$errors = form_get_errors();
......@@ -62,7 +62,7 @@ function testConfigForm() {
);
$this->assertTrue($valid_form, format_string('Input values: %values<br/>Validation handler errors: %errors', $args));
foreach ($this->values as $form_key => $data) {
foreach ($this->values as $data) {
$this->assertEqual($data['#value'], config($data['#config_name'])->get($data['#config_key']));
}
}
......
This diff is collapsed.
......@@ -8,6 +8,7 @@
namespace Drupal\user\Tests;
use Drupal\system\Tests\System\SystemConfigFormTestBase;
use Drupal\user\AccountSettingsForm;
class UserAdminSettingsFormTest extends SystemConfigFormTestBase {
......@@ -21,8 +22,8 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
module_load_include('admin.inc', 'user');
$this->form_id = 'user_admin_settings';
$this->form = AccountSettingsForm::create($this->container);
$this->values = array(
'anonymous' => array(
'#value' => $this->randomString(10),
......
This diff is collapsed.
......@@ -1008,11 +1008,8 @@ function user_menu() {
$items['admin/config/people/accounts'] = array(
'title' => 'Account settings',
'description' => 'Configure default behavior of users, including registration requirements, e-mails, and fields.',
'page callback' => 'drupal_get_form',
'page arguments' => array('user_admin_settings'),
'access arguments' => array('administer users'),
'file' => 'user.admin.inc',
'weight' => -10,
'route_name' => 'user_account_settings',
);
$items['admin/config/people/accounts/settings'] = array(
'title' => 'Settings',
......
......@@ -18,3 +18,10 @@ user_autocomplete_anonymous:
_controller: '\Drupal\user\UserAutocompleteController::autocompleteUserAnonymous'
requirements:
_permission: 'access user profiles'
user_account_settings:
pattern: '/admin/config/people/accounts'
defaults:
_form: '\Drupal\user\AccountSettingsForm'
requirements:
_permission: 'administer users'
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