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

[6.x] Strict parameter added to assertJsonPath #30142

Merged
merged 1 commit into from Oct 1, 2019

Conversation

@ttrig
Copy link
Contributor

commented Sep 30, 2019

Allows strict comparison when using assertJsonPath.

Example response data:

{
    "foo": false
}

The problem

$response->assertJsonPath('foo', 0); // pass
$response->assertJsonPath('foo', null); // pass

The solution

$response->assertJsonPath('foo', 0, true); // fail
$response->assertJsonPath('foo', null, true); // fail
$response->assertJsonPath('foo', false, true); // pass
@driesvints driesvints changed the title Strict parameter added to assertJsonPath [6.x] Strict parameter added to assertJsonPath Sep 30, 2019
@BrandonSurowiec

This comment has been minimized.

Copy link
Contributor

commented Sep 30, 2019

Can we add an additional assertJsonPathStrict() method?

public function assertJsonPathStrict($path, $expect)
{
    return $this->assertJsonPath($path, $expect, true);
}
@ttrig

This comment has been minimized.

Copy link
Contributor Author

commented Oct 1, 2019

Can we add an additional assertJsonPathStrict() method?

public function assertJsonPathStrict($path, $expect)
{
    return $this->assertJsonPath($path, $expect, true);
}

Sure, great suggestion.

@taylorotwell taylorotwell merged commit abd94c9 into laravel:6.x Oct 1, 2019
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
i-bajrai added a commit to i-bajrai/framework that referenced this pull request Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.