You are here

public function HoneypotTestController::submitFormPage in Honeypot 8

Same name and namespace in other branches
  1. 2.0.x tests/modules/honeypot_test/src/Controller/HoneypotTestController.php \Drupal\honeypot_test\Controller\HoneypotTestController::submitFormPage()

Page that triggers a programmatic form submission.

Returns the validation errors triggered by the form submission as json.

1 string reference to 'HoneypotTestController::submitFormPage'
honeypot_test.routing.yml in tests/modules/honeypot_test/honeypot_test.routing.yml
tests/modules/honeypot_test/honeypot_test.routing.yml

File

tests/modules/honeypot_test/src/Controller/HoneypotTestController.php, line 21

Class

HoneypotTestController
Controller for honeypot_test routes.

Namespace

Drupal\honeypot_test\Controller

Code

public function submitFormPage() {
  $form_state = new FormState();
  $values = [
    'name' => 'robo-user',
    'mail' => 'robouser@example.com',
    'op' => $this
      ->t('Submit'),
  ];
  $form_state
    ->setValues($values);
  \Drupal::formBuilder()
    ->submitForm('\\Drupal\\user\\Form\\UserPasswordForm', $form_state);
  return new JsonResponse($form_state
    ->getErrors());
}