Skip to content

[5.8] Add message value assertion to assertJsonValidationErrors#28787

Merged
taylorotwell merged 1 commit intolaravel:5.8from
ahinkle:assertJsonValidationError
Jun 11, 2019
Merged

[5.8] Add message value assertion to assertJsonValidationErrors#28787
taylorotwell merged 1 commit intolaravel:5.8from
ahinkle:assertJsonValidationError

Conversation

@ahinkle
Copy link
Copy Markdown
Contributor

@ahinkle ahinkle commented Jun 10, 2019

Resubmit of #27655.

This PR adds the assertion for JSON validation error messages in assertJsonValidationErrors.

Currently, we can only check json validation error keys:

$this->assertJsonValidationErrors('key');
$this->assertJsonValidationErrors(['foo', 'bar']);

With this addition, you will be able to check the key and the message:
$this->assertJsonValidationErrors(['key' => 'validation message']);

You can still continue to use the normal functionality by just passing a key, array of keys, or a mix of each.

@taylorotwell
Copy link
Copy Markdown
Member

@ahinkle I shipped an augmentation to this method so that it handles arrays of error messages for a single key:

image

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