Skip to content

Commit

Permalink
Update validation errors (#226)
Browse files Browse the repository at this point in the history
* Update validation errors

* Make validation assertions more vague

Because framework versions display different messages and we want to test across multiple versions.
  • Loading branch information
lorisleiva authored Feb 22, 2023
1 parent 70f78fb commit 5b03bbd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions tests/AsActionWithValidatedAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ public function asCommand(Command $command): void

// Then we expect a forbidden response.
$response->assertStatus(422);
$response->assertJsonValidationErrors([
'operation' => 'The selected operation is invalid.',
'left' => 'The left must be an integer.',
'right' => 'The right field is required.',
]);
$response->assertJsonValidationErrors(['operation', 'left', 'right']);
});

it('runs as a job', function () {
Expand Down
6 changes: 1 addition & 5 deletions tests/AsControllerWithAuthorizeAndRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ public function handle(ActionRequest $request)

// Then we receive a validation error.
$response->assertStatus(422);
$response->assertJsonValidationErrors([
'operation' => 'The selected operation is invalid.',
'left' => 'The left must be an integer.',
'right' => 'The right field is required.',
]);
$response->assertJsonValidationErrors(['operation', 'left', 'right']);
});

it('uses a new validator at every request', function () {
Expand Down
6 changes: 1 addition & 5 deletions tests/AsControllerWithValidatedAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,7 @@ public function handle(ActionRequest $request): array

// Then we receive a validation error.
$response->assertStatus(422);
$response->assertJsonValidationErrors([
'operation' => 'The selected operation is invalid.',
'left' => 'The left must be an integer.',
'right' => 'The right field is required.',
]);
$response->assertJsonValidationErrors(['operation', 'left', 'right']);
});

it('uses a new validator at every request', function () {
Expand Down

0 comments on commit 5b03bbd

Please sign in to comment.