Skip to content

Comments

[10.x] Escape values before checking for their presence in HTML part of Mailables#42923

Merged
taylorotwell merged 1 commit intolaravel:masterfrom
turanjanin:fix-mailable-assertions
Jun 30, 2022
Merged

[10.x] Escape values before checking for their presence in HTML part of Mailables#42923
taylorotwell merged 1 commit intolaravel:masterfrom
turanjanin:fix-mailable-assertions

Conversation

@turanjanin
Copy link
Contributor

Laravel offers the ability to assert presence of a value inside the HTML for both views and mailables. However, the implementation of these assertions differ in a way that may cause confusion and occasional failing tests:

TestResponse::assertSee() escapes the HTML by default,
Mailable::assertSeeInHtml() does not escape the HTML.

This means that, for the same HTML, $response->assertSee("O'Connor"); will pass, while $mail->assertSeeInHtml("O'Connor"); will fail.

The goal of this PR is to align the behaviour of Mailable assertion methods with the rest of the similar assertion methods.

@turanjanin turanjanin force-pushed the fix-mailable-assertions branch from 99f389a to 3ec397b Compare June 29, 2022 09:14
@turanjanin turanjanin changed the title Escape values before checking for their presence in HTML part of Mailables [10.x] Escape values before checking for their presence in HTML part of Mailables Jun 29, 2022
@taylorotwell taylorotwell merged commit 55a1ea2 into laravel:master Jun 30, 2022
@turanjanin turanjanin deleted the fix-mailable-assertions branch June 30, 2022 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants