function FormSubmitterTest::testRedirectWithResponseObject

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testRedirectWithResponseObject()
  2. 10 core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testRedirectWithResponseObject()
  3. 11.x core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php \Drupal\Tests\Core\Form\FormSubmitterTest::testRedirectWithResponseObject()

Tests the redirectForm() method with a response object.

@covers ::redirectForm

File

core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php, line 174

Class

FormSubmitterTest
@coversDefaultClass \Drupal\Core\Form\FormSubmitter @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function testRedirectWithResponseObject() {
    $form_submitter = $this->getFormSubmitter();
    $redirect = new RedirectResponse('/example');
    $form_state = $this->createMock('Drupal\\Core\\Form\\FormStateInterface');
    $form_state->expects($this->once())
        ->method('getRedirect')
        ->willReturn($redirect);
    $result_redirect = $form_submitter->redirectForm($form_state);
    $this->assertSame($redirect, $result_redirect);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.