You are here

form_base_test.inc in Drupal 9

Same filename and directory in other branches
  1. 8 core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc

Functions in the global namespace for \Drupal\Tests\Core\Form\FormTestBase.

File

core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
View source
<?php

/**
 * @file
 * Functions in the global namespace for \Drupal\Tests\Core\Form\FormTestBase.
 */

/**
 * Creates a test form.
 *
 * @return array
 *   The form array
 */
function test_form_id() {
  $form['test'] = [
    '#type' => 'textfield',
    '#title' => 'Test',
  ];
  $form['options'] = [
    '#type' => 'radios',
    '#options' => [
      'foo' => 'foo',
      'bar' => 'bar',
    ],
  ];
  $form['value'] = [
    '#type' => 'value',
    '#value' => 'bananas',
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => 'Submit',
  ];
  return $form;
}

Functions

Namesort descending Description
test_form_id Creates a test form.