diff --git a/tests/Functional/Action/RequestActionTest.php b/tests/Functional/Action/RequestActionTest.php index a7a22ac50..a078f0b8f 100644 --- a/tests/Functional/Action/RequestActionTest.php +++ b/tests/Functional/Action/RequestActionTest.php @@ -20,6 +20,19 @@ final class RequestActionTest extends WebTestCase { + public function testItSubmitsResetPasswordRequestWithNonValidData(): void + { + $client = static::createClient(); + $client->request('GET', '/request'); + + static::assertResponseIsSuccessful(); + + $client->submitForm('submit'); + + static::assertResponseIsSuccessful(); + static::assertRouteSame('sonata_user_admin_resetting_request'); + } + public function testItSubmitsResetPasswordRequestWithNonExistentUser(): void { $client = static::createClient(); diff --git a/tests/Functional/Action/ResetActionTest.php b/tests/Functional/Action/ResetActionTest.php index e3142411a..fd1f8b509 100644 --- a/tests/Functional/Action/ResetActionTest.php +++ b/tests/Functional/Action/ResetActionTest.php @@ -30,6 +30,29 @@ public function testItRedirectsToResetPasswordRequestOnInvalidToken(): void static::assertResponseStatusCodeSame(404); } + public function testItSubmitsResetPasswordFormWithNonValidData(): void + { + $client = static::createClient(); + + $user = $this->prepareData(); + $confirmationToken = $user->getConfirmationToken(); + \assert(null !== $confirmationToken); + + static::assertSame($user->getPassword(), 'random_password'); + + $client->request('GET', sprintf('/reset/%s', $confirmationToken)); + + static::assertResponseIsSuccessful(); + + $client->submitForm('submit', [ + 'resetting_form[plainPassword][first]' => 'new_password', + 'resetting_form[plainPassword][second]' => 'not_matching_password', + ]); + + static::assertResponseIsSuccessful(); + static::assertRouteSame('sonata_user_admin_resetting_reset'); + } + public function testItResetsPassword(): void { $client = static::createClient();