public function FormSubmitterTest::testHandleFormSubmissionWithResponses in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testHandleFormSubmissionWithResponses()
- 10 core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testHandleFormSubmissionWithResponses()
@covers ::doSubmitForm
@dataProvider providerTestHandleFormSubmissionWithResponses
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ FormSubmitterTest.php, line 77
Class
- FormSubmitterTest
- @coversDefaultClass \Drupal\Core\Form\FormSubmitter @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testHandleFormSubmissionWithResponses($class, $form_state_key) {
$response = $this
->getMockBuilder($class)
->disableOriginalConstructor()
->getMock();
$response
->expects($this
->any())
->method('prepare')
->will($this
->returnValue($response));
$form_state = (new FormState())
->setSubmitted()
->setFormState([
$form_state_key => $response,
]);
$form_submitter = $this
->getFormSubmitter();
$form = [];
$return = $form_submitter
->doSubmitForm($form, $form_state);
$this
->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $return);
}