From 7c9f5f6bf8a25e029001bd81d697bb992efc0577 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Mon, 2 Dec 2024 20:04:48 +0000 Subject: [PATCH] Add pre-request for the form key --- app/tests/Controller/User/RegisterUserActionTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/tests/Controller/User/RegisterUserActionTest.php b/app/tests/Controller/User/RegisterUserActionTest.php index a053c03..deda183 100644 --- a/app/tests/Controller/User/RegisterUserActionTest.php +++ b/app/tests/Controller/User/RegisterUserActionTest.php @@ -99,8 +99,14 @@ class RegisterUserActionTest extends TestCase UserRepositoryInterface::class, $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); $this->assertEquals(400, $response->getStatusCode());