Update the tests for the flash messages.

This commit is contained in:
Dave Smith-Hayes 2024-06-16 07:35:27 -04:00
parent d25cdd7b1e
commit 34e45ecaee

View File

@ -92,11 +92,19 @@ class RegisterUserActionTest extends TestCase
$response = $app->handle($request);
$this->assertEquals(400, $response->getStatusCode());
$responseBody = $response->getBody();
$this->assertTrue((bool)preg_match('/flash error/', $responseBody));
$this->assertTrue((bool)preg_match('/Unable to register user/', $responseBody));
/**
* The Flash messages are already exhausted while rendering the
* templates. We should check the template for the error.
*/
$flash = $container->get(SessionInterface::class)->getFlash();
$errorMessages = $flash->get('error');
$this->assertIsArray($errorMessages);
$this->assertNotEmpty($errorMessages);
$this->assertEquals('Unable to register user.', $errorMessages[0]);
//$this->assertNotEmpty($errorMessages);
//$this->assertEquals('Unable to register user.', $errorMessages[0]);
}
public function testMismatchPassword(): void