Update the tests for the flash messages.
This commit is contained in:
parent
d25cdd7b1e
commit
34e45ecaee
@ -92,11 +92,19 @@ class RegisterUserActionTest extends TestCase
|
|||||||
$response = $app->handle($request);
|
$response = $app->handle($request);
|
||||||
$this->assertEquals(400, $response->getStatusCode());
|
$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();
|
$flash = $container->get(SessionInterface::class)->getFlash();
|
||||||
$errorMessages = $flash->get('error');
|
$errorMessages = $flash->get('error');
|
||||||
$this->assertIsArray($errorMessages);
|
$this->assertIsArray($errorMessages);
|
||||||
$this->assertNotEmpty($errorMessages);
|
//$this->assertNotEmpty($errorMessages);
|
||||||
$this->assertEquals('Unable to register user.', $errorMessages[0]);
|
//$this->assertEquals('Unable to register user.', $errorMessages[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMismatchPassword(): void
|
public function testMismatchPassword(): void
|
||||||
|
Loading…
Reference in New Issue
Block a user