Flash message is empty for some reason
This commit is contained in:
parent
1914885d04
commit
ea97887cac
@ -21,7 +21,8 @@ class RegisterUserAction extends Controller
|
|||||||
$requestData = $this->request->getParsedBody();
|
$requestData = $this->request->getParsedBody();
|
||||||
|
|
||||||
if ($requestData['password'] !== $requestData['checked_password']) {
|
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');
|
$response = $this->render('user/register.twig');
|
||||||
return $response->withStatus(400);
|
return $response->withStatus(400);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,6 @@ class RegisterUserActionTest extends TestCase
|
|||||||
public function testFailingRegistration(): void
|
public function testFailingRegistration(): void
|
||||||
{
|
{
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
$app = $this->getAppInstance();
|
$app = $this->getAppInstance();
|
||||||
|
|
||||||
/** @var $container \DI\Container */
|
/** @var $container \DI\Container */
|
||||||
@ -75,7 +74,7 @@ class RegisterUserActionTest extends TestCase
|
|||||||
$flash = $container->get(SessionInterface::class)->getFlash();
|
$flash = $container->get(SessionInterface::class)->getFlash();
|
||||||
$errorMessages = $flash->get('error');
|
$errorMessages = $flash->get('error');
|
||||||
$this->assertIsArray($errorMessages);
|
$this->assertIsArray($errorMessages);
|
||||||
$this->assertNotNull($errorMessages);
|
$this->assertNotEmpty($errorMessages);
|
||||||
$this->assertEquals('Unable to register user.', $errorMessage[0]);
|
$this->assertEquals('Unable to register user.', $errorMessages[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user