diff --git a/app/Enums/ApiError.php b/app/Enums/ApiError.php index 9e84968..8031b63 100644 --- a/app/Enums/ApiError.php +++ b/app/Enums/ApiError.php @@ -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.'), diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index b13c0e9..84eabe1 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -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: diff --git a/tests/Feature/ApiV2/CustomerTest.php b/tests/Feature/ApiV2/CustomerTest.php index ed36117..1bbd64b 100644 --- a/tests/Feature/ApiV2/CustomerTest.php +++ b/tests/Feature/ApiV2/CustomerTest.php @@ -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') - ); } /**