public function FormBuilderTest::testGetFormIdWithBaseForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testGetFormIdWithBaseForm()
Tests the getFormId() method with a base form object.
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php, line 117 - Contains \Drupal\Tests\Core\Form\FormBuilderTest.
Class
- FormBuilderTest
- @coversDefaultClass \Drupal\Core\Form\FormBuilder @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testGetFormIdWithBaseForm() {
$expected_form_id = 'my_module_form_id';
$base_form_id = 'my_module';
$form_arg = $this
->getMock('Drupal\\Core\\Form\\BaseFormIdInterface');
$form_arg
->expects($this
->once())
->method('getFormId')
->will($this
->returnValue($expected_form_id));
$form_arg
->expects($this
->once())
->method('getBaseFormId')
->will($this
->returnValue($base_form_id));
$form_state = new FormState();
$form_id = $this->formBuilder
->getFormId($form_arg, $form_state);
$this
->assertSame($expected_form_id, $form_id);
$this
->assertSame($form_arg, $form_state
->getFormObject());
$this
->assertSame($base_form_id, $form_state
->getBuildInfo()['base_form_id']);
}