I want to test the sign in presenter action with form submit and correct response in redirect. E.g. I want to test that after correct login, user is redirected somewhere and flash message with text "login successful" is displayed.
In all the examples the only way to test correct form behavior is to test that I get RedirectResponse (see below). Isn't that too little? How to do the test I describe? Is it even possible?
function testSignUpSuccess()
{
$post = [
'identity' => 'john.doe@gmail.com',
'password' => 'superSecret123',
];
$pt = $this->getPresenterTester()
->setPresenter('Sign')
->setAction('up')
->setHandle('signUpForm-submit')
->setPost($post);
$response = $pt->run();
Assert::true($response instanceof Nette\Application\Responses\RedirectResponse);
//TODO test that flashMessage: 'login successful' is displayed on final page
}
Note: This example uses PresenterTester tool to get the response but the important part is about working with that response so it doesn't matter whether you get it by native means or by this tool.