function FormAjaxResponseBuilderTest::testBuildResponseResponse
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php \Drupal\Tests\Core\Form\FormAjaxResponseBuilderTest::testBuildResponseResponse()
- 10 core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php \Drupal\Tests\Core\Form\FormAjaxResponseBuilderTest::testBuildResponseResponse()
- 11.x core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php \Drupal\Tests\Core\Form\FormAjaxResponseBuilderTest::testBuildResponseResponse()
@covers ::buildResponse
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormAjaxResponseBuilderTest.php, line 113
Class
- FormAjaxResponseBuilderTest
- @coversDefaultClass \Drupal\Core\Form\FormAjaxResponseBuilder @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testBuildResponseResponse() {
$triggering_element = [
'#ajax' => [
'callback' => function (array $form, FormStateInterface $form_state) {
return new AjaxResponse([]);
},
],
];
$request = new Request();
$form = [];
$form_state = new FormState();
$form_state->setTriggeringElement($triggering_element);
$commands = [];
$this->renderer
->expects($this->never())
->method('renderResponse');
$result = $this->formAjaxResponseBuilder
->buildResponse($request, $form, $form_state, $commands);
$this->assertInstanceOf('\\Drupal\\Core\\Ajax\\AjaxResponse', $result);
$this->assertSame($commands, $result->getCommands());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.