add missing validation exception message on enum
This commit is contained in:
parent
f243e80ce7
commit
82b40360e6
3 changed files with 2 additions and 9 deletions
|
|
@ -44,6 +44,7 @@ class ApiError extends BaseEnum
|
|||
{
|
||||
return [
|
||||
'modelNotFound' => trans('%s not found.'),
|
||||
'validationFailed' => trans('Could not validate data.'),
|
||||
'customerExists' => trans('User already registered on this site.'),
|
||||
'customerNotActivated' => trans('Account is not activated.'),
|
||||
'customerAlreadyActive' => trans('User already active.'),
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Handler extends ExceptionHandler
|
|||
$request,
|
||||
$e->status,
|
||||
ApiError::validationFailed()->value,
|
||||
sprintf('%s, %s', ApiError::validationFailed()->label, $e->getMessage()),
|
||||
sprintf(ApiError::validationFailed()->label, $e->getMessage()),
|
||||
['errors' => $e->errors()]
|
||||
);
|
||||
case ModelNotFoundException::class:
|
||||
|
|
|
|||
|
|
@ -119,10 +119,6 @@ class CustomerTest extends ApiBase
|
|||
$json = $response->decodeResponseJson();
|
||||
$this->assertApiResponseStatusIs($json, ApiStatus::KO());
|
||||
$this->assertEquals(ApiError::validationFailed()->value, $json->json('data.code'));
|
||||
$this->assertEquals(
|
||||
ApiError::validationFailed()->label . ', The given data was invalid.',
|
||||
$json->json('data.message')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,10 +194,6 @@ class CustomerTest extends ApiBase
|
|||
$json = $response->decodeResponseJson();
|
||||
$this->assertApiResponseStatusIs($json, ApiStatus::KO());
|
||||
$this->assertEquals(ApiError::validationFailed()->value, $json->json('data.code'));
|
||||
$this->assertEquals(
|
||||
ApiError::validationFailed()->label . ', The given data was invalid.',
|
||||
$json->json('data.message')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue