function FormBuilderTest::buildTestFormStructure
Returns a test form array for use in form builder tests.
Return value
array The form array.
15 calls to FormBuilderTest::buildTestFormStructure()
- FormBuilderTest::testBuildFormWithObject in core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php - Tests the buildForm() method with a form object.
- FormBuilderTest::testBuildFormWithTriggeringElement in core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php - Tests whether the triggering element is properly identified.
- FormBuilderTest::testFormCacheDeletionCached in core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php - Tests that a cached form is deleted after submit.
- FormBuilderTest::testFormCacheDeletionUncached in core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php - Tests that an uncached form does not trigger cache set or delete.
- FormBuilderTest::testFormTokenCacheability in core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php - Tests form token cacheability.
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php, line 64
Class
Namespace
Drupal\Tests\Core\FormCode
public static function buildTestFormStructure() : array {
$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',
];
$form['actions']['other_action'] = [
'#type' => 'submit',
'#name' => 'other_action',
'#value' => 'Other action',
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.