From 0750998137990074e69340042c8d19f2ef92c670 Mon Sep 17 00:00:00 2001 From: Florent Destremau Date: Wed, 12 Feb 2025 23:38:35 +0100 Subject: [PATCH 1/3] Update Test.ResetPasswordController.tpl.php More precise fetching for email body so that the link is not truncated as stated here https://github.com/SymfonyCasts/reset-password-bundle/issues/345 --- templates/resetPassword/Test.ResetPasswordController.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/resetPassword/Test.ResetPasswordController.tpl.php b/templates/resetPassword/Test.ResetPasswordController.tpl.php index 16a28b3e5..c998a8422 100644 --- a/templates/resetPassword/Test.ResetPasswordController.tpl.php +++ b/templates/resetPassword/Test.ResetPasswordController.tpl.php @@ -70,7 +70,7 @@ public function testResetPasswordController(): void self::assertStringContainsString('This link will expire in 1 hour', $crawler->html()); // Test the link sent in the email is valid - $email = $messages[0]->toString(); + $email = $messages[0]->getTextBody(); preg_match('#(/reset-password/reset/[a-zA-Z0-9]+)#', $email, $resetLink); $this->client->request('GET', $resetLink[1]); From b9bd060c401862a948c694754647b1a0fc8a09d0 Mon Sep 17 00:00:00 2001 From: Florent Destremau Date: Wed, 5 Mar 2025 20:40:59 +0100 Subject: [PATCH 2/3] Added type-hinting --- templates/resetPassword/Test.ResetPasswordController.tpl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/resetPassword/Test.ResetPasswordController.tpl.php b/templates/resetPassword/Test.ResetPasswordController.tpl.php index c998a8422..aee909d4c 100644 --- a/templates/resetPassword/Test.ResetPasswordController.tpl.php +++ b/templates/resetPassword/Test.ResetPasswordController.tpl.php @@ -70,7 +70,9 @@ public function testResetPasswordController(): void self::assertStringContainsString('This link will expire in 1 hour', $crawler->html()); // Test the link sent in the email is valid + /** @var array $messages */ $email = $messages[0]->getTextBody(); + self::assertIsString($emailBody); preg_match('#(/reset-password/reset/[a-zA-Z0-9]+)#', $email, $resetLink); $this->client->request('GET', $resetLink[1]); From 40c9950c1841d5a6605e46de933d6aa816778805 Mon Sep 17 00:00:00 2001 From: Florent Destremau Date: Wed, 5 Mar 2025 21:27:50 +0100 Subject: [PATCH 3/3] Fix typo --- templates/resetPassword/Test.ResetPasswordController.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/resetPassword/Test.ResetPasswordController.tpl.php b/templates/resetPassword/Test.ResetPasswordController.tpl.php index aee909d4c..8ffbba143 100644 --- a/templates/resetPassword/Test.ResetPasswordController.tpl.php +++ b/templates/resetPassword/Test.ResetPasswordController.tpl.php @@ -72,7 +72,7 @@ public function testResetPasswordController(): void // Test the link sent in the email is valid /** @var array $messages */ $email = $messages[0]->getTextBody(); - self::assertIsString($emailBody); + self::assertIsString($email); preg_match('#(/reset-password/reset/[a-zA-Z0-9]+)#', $email, $resetLink); $this->client->request('GET', $resetLink[1]);