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

Projects
None yet
2 participants
@stidges
Copy link
Contributor

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');

stidges added some commits Apr 6, 2017

@taylorotwell taylorotwell merged commit acc5feb into laravel:5.4 Apr 6, 2017

2 checks passed

continuous-integration/styleci/pr The StyleCI analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@stidges stidges deleted the stidges:5.4-response-assertions branch Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.