function UserAccountFormFieldsTest::testInstallConfigureForm

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php \Drupal\Tests\user\Kernel\UserAccountFormFieldsTest::testInstallConfigureForm()
  2. 8.9.x core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php \Drupal\Tests\user\Kernel\UserAccountFormFieldsTest::testInstallConfigureForm()
  3. 11.x core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php \Drupal\Tests\user\Kernel\UserAccountFormFieldsTest::testInstallConfigureForm()

Tests the root user account form section in the "Configure site" form.

File

core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php, line 32

Class

UserAccountFormFieldsTest
Verifies the field order in user account forms.

Namespace

Drupal\Tests\user\Kernel

Code

public function testInstallConfigureForm() : void {
    require_once $this->root . '/core/includes/install.core.inc';
    require_once $this->root . '/core/includes/install.inc';
    $install_state = install_state_defaults();
    $form_state = new FormState();
    $form_state->addBuildInfo('args', [
        &$install_state,
    ]);
    $form = $this->container
        ->get('form_builder')
        ->buildForm('Drupal\\Core\\Installer\\Form\\SiteConfigureForm', $form_state);
    // Verify name and pass field order.
    $this->assertFieldOrder($form['admin_account']['account']);
    // Verify that web browsers may autocomplete the email value and
    // autofill/prefill the name and pass values.
    foreach ([
        'mail',
        'name',
        'pass',
    ] as $key) {
        $this->assertFalse(isset($form['account'][$key]['#attributes']['autocomplete']), "'{$key}' field: 'autocomplete' attribute not found.");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.