diff --git a/app/tests/Controller/User/RegisterUserActionTest.php b/app/tests/Controller/User/RegisterUserActionTest.php index cafd73b..95f73c8 100644 --- a/app/tests/Controller/User/RegisterUserActionTest.php +++ b/app/tests/Controller/User/RegisterUserActionTest.php @@ -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