Flash message is empty for some reason

This commit is contained in:
Dave Smith-Hayes 2024-06-04 21:33:20 -04:00
parent 1914885d04
commit ea97887cac
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,8 @@ class RegisterUserAction extends Controller
$requestData = $this->request->getParsedBody();
if ($requestData['password'] !== $requestData['checked_password']) {
$this->session->getFlash()->add('error', "Passwords do not match.");
$this->session->getFlash()
->add('error', "Passwords do not match.");
$response = $this->render('user/register.twig');
return $response->withStatus(400);
}

View File

@ -54,7 +54,6 @@ class RegisterUserActionTest extends TestCase
public function testFailingRegistration(): void
{
$user = $this->getUser();
$app = $this->getAppInstance();
/** @var $container \DI\Container */
@ -75,7 +74,7 @@ class RegisterUserActionTest extends TestCase
$flash = $container->get(SessionInterface::class)->getFlash();
$errorMessages = $flash->get('error');
$this->assertIsArray($errorMessages);
$this->assertNotNull($errorMessages);
$this->assertEquals('Unable to register user.', $errorMessage[0]);
$this->assertNotEmpty($errorMessages);
$this->assertEquals('Unable to register user.', $errorMessages[0]);
}
}