mglaman / drupal-test-helpers

Helpers for writing better Kernel and Unit tests for Drupal
GNU General Public License v2.0
10 stars 2 forks source link

doFormSubmit should catch EnforcedResponseException when test HTTP kernel is active #10

Closed mglaman closed 5 months ago

mglaman commented 1 year ago
        $response = $this->doRequest(Request::create($uri, 'POST', $formData));
        if ($followRedirect && $response->getStatusCode() === Response::HTTP_SEE_OTHER) {
            $request = Request::create((string) $response->headers->get('Location'));
            return $this->doRequest($request);
        }

The doRequest needs to wrap a try/catch and take that exception response.