Add pre-request for the form key

This commit is contained in:
Dave Smith-Hayes 2024-12-02 20:04:48 +00:00
parent bf48532ac1
commit 7c9f5f6bf8

View File

@ -99,8 +99,14 @@ class RegisterUserActionTest extends TestCase
UserRepositoryInterface::class, UserRepositoryInterface::class,
$userRepository->reveal() $userRepository->reveal()
); );
// get the form key
$getUserRequest = $this->createNewUserRequestForFormKey();
$response = $app->handle($getUserRequest);
$formKey = $container->get(SessionInterface::class)->get("form_key");
$this->assertIsString($formKey);
$request = $this->createNewUserRequest(); $request = $this->createNewUserRequest($formKey);
$response = $app->handle($request); $response = $app->handle($request);
$this->assertEquals(400, $response->getStatusCode()); $this->assertEquals(400, $response->getStatusCode());