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

[5.4] Add assertSeeText() and assertDontSeeText() to TestResponse #18690

Merged
merged 2 commits into from Apr 6, 2017

Conversation

stidges
Copy link
Contributor

@stidges stidges commented Apr 6, 2017

This pull request adds two new assertions to the TestResponse class: assertSeeText() and assertDontSeeText().

Motivation

These assertions are really helpful when asserting against HTML responses, as visual design of the page shouldn't make a test pass or fail. Given the following HTML:

<strong>Views:</strong> 2

I would currently test this using the following assertion:

$response->assertSee('<strong>Views:</strong> 2');

But whenever a designer thinks it would look better if it was also italic, or add some extra CSS classes, my test would break. All I really care about is that the views are shown on the page. The assertSeeText() assertion solves this issue:

$response->assertSeeText('Views: 2');

@taylorotwell taylorotwell merged commit acc5feb into laravel:5.4 Apr 6, 2017
@stidges stidges deleted the 5.4-response-assertions branch April 6, 2017 15:19
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.

None yet

2 participants