public function FormSubmitterTest::testRedirectWithoutResult in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testRedirectWithoutResult()
- 9 core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testRedirectWithoutResult()
Tests the redirectForm() method when no redirect is expected.
@covers ::redirectForm
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ FormSubmitterTest.php, line 199
Class
- FormSubmitterTest
- @coversDefaultClass \Drupal\Core\Form\FormSubmitter @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testRedirectWithoutResult() {
$form_submitter = $this
->getFormSubmitter();
$this->urlGenerator
->expects($this
->never())
->method('generateFromRoute');
$this->unroutedUrlAssembler
->expects($this
->never())
->method('assemble');
$container = new ContainerBuilder();
$container
->set('url_generator', $this->urlGenerator);
$container
->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
\Drupal::setContainer($container);
$form_state = $this
->createMock('Drupal\\Core\\Form\\FormStateInterface');
$form_state
->expects($this
->once())
->method('getRedirect')
->willReturn(FALSE);
$redirect = $form_submitter
->redirectForm($form_state);
$this
->assertNull($redirect);
}