Skip to content
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

[11.x] assertSeeHtml, assertDontSeeHtml and assertSeeHtmlInOrder testing methods #52285

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

gdebrauwer
Copy link
Contributor

When testing a Livewire component, the assertSeeHtml and assertSeeHtmlInOrder methods are available. I was surprised when I found out that those methods do not exist in Laravel's TestResponse class. You must set the escape parameter of the assertSee and assertSeeInOrder methods to falseto assert HTML.

Making dedicated 'html' methods available makes this a bit more readable and ensures consistency with Livewire.

$response->assertSeeHtml('<li>foo</li>');

$response->assertSeeHtmlInOrder(['<li>foo</li>', '<li>bar</li>', '<li>baz</li>']);

$response->assertDontSeeHtml('<li>foo</li>');

@taylorotwell taylorotwell merged commit 5baa538 into laravel:11.x Jul 29, 2024
31 checks passed
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