function FormBuilderTest::testGetFormWithObject
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormWithObject()
- 8.9.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormWithObject()
- 10 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormWithObject()
Tests the getForm() method with a form object.
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php, line 240
Class
- FormBuilderTest
- @coversDefaultClass \Drupal\Core\Form\FormBuilder @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testGetFormWithObject() : void {
$form_id = 'test_form_id';
$expected_form = $form_id();
$form_arg = $this->getMockForm($form_id, $expected_form);
$form = $this->formBuilder
->getForm($form_arg);
$this->assertFormElement($expected_form, $form, 'test');
$this->assertArrayHasKey('#id', $form);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.