function UserAccountFormPasswordResetTest::buildAccountForm

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php \Drupal\Tests\user\Kernel\UserAccountFormPasswordResetTest::buildAccountForm()
  2. 11.x core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php \Drupal\Tests\user\Kernel\UserAccountFormPasswordResetTest::buildAccountForm()

Builds the user account form for a given operation.

Parameters

string $operation: The entity operation; one of 'register' or 'default'.

Return value

array The form array.

1 call to UserAccountFormPasswordResetTest::buildAccountForm()
UserAccountFormPasswordResetTest::testPasswordResetToken in core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php
Tests the reset token used only from query string.

File

core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php, line 79

Class

UserAccountFormPasswordResetTest
Verifies that the password reset behaves as expected with form elements.

Namespace

Drupal\Tests\user\Kernel

Code

protected function buildAccountForm($operation) {
  // @see HtmlEntityFormController::getFormObject()
  $entity_type = 'user';
  if ($operation != 'register') {
    $entity = $this->user;
  }
  else {
    $entity = $this->container
      ->get('entity_type.manager')
      ->getStorage($entity_type)
      ->create();
  }
  // @see EntityFormBuilder::getForm()
  return $this->container
    ->get('entity.form_builder')
    ->getForm($entity, $operation);
}

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