-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The default test from MakerBundle is failing #345
The default test from MakerBundle is failing #345
Comments
More precise fetching for email body so that the link is not truncated as stated here SymfonyCasts/reset-password-bundle#345
Hey @florentdestremau , Thanks for reporting it. What do you suggest instead toString() there? Would you like to create a PR to fix it? |
This is my solution, I type-hint the $messages and use the getTextBody. Maybe the regex could be updated to ignore \r\n characters also, what solution would you prefer ? // Test the link sent in the email is valid
/** @var array<TemplatedEmail> $messages */
$emailBody = $messages[0]->getTextBody();
self::assertIsString($emailBody);
preg_match('#(/reinitialisation-mot-de-passe/reset/[a-zA-Z0-9]+)#', $emailBody, $resetLink);
self::assertArrayHasKey(1, $resetLink);
$this->client->request('GET', $resetLink[1] ?? 'http://localhost'); |
As I understand, we're just lucky in our tests that the link was not split by the So that Could you please create a PR for this? |
Yes will do in the week to come |
Actually I had forgotten but I already made the PR: edit: didn't point the branch to the main repository, tho 😅 |
Look good to me, I think we're ready to create this PR on symfony/maker-bundle repo |
I did it at the same time: symfony/maker-bundle#1669 |
I lost 2 hours debugging the generated test from the Maker command.
This part:
...actually truncates the reset link and thus creates a regex where only half of the token is captured in the regex. This is my
dd($emailBody)
:The email content should be clearly the html or the text but toString is not reliable.
The text was updated successfully, but these errors were encountered: