This repository was archived by the owner on Jul 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ class ArtisanApiService implements ArtisanApiServiceInterface
36
36
*/
37
37
protected $ fractal ;
38
38
39
- protected $ errorKey ;
39
+ protected $ errorKey = ' error ' ;
40
40
41
- protected $ errorDataKey ;
41
+ protected $ errorDataKey = ' errors ' ;
42
42
43
- protected $ messageKey ;
43
+ protected $ messageKey = ' message ' ;
44
44
45
45
/**
46
46
* ArtisanApiService constructor.
@@ -49,9 +49,11 @@ class ArtisanApiService implements ArtisanApiServiceInterface
49
49
*/
50
50
public function __construct (ResponseFactory $ response , Fractal $ fractal )
51
51
{
52
- $ this ->errorKey = config ('api.error_message_key ' ) ?? 'error ' ;
53
- $ this ->errorDataKey = config ('api.error_data_key ' ) ?? 'errors ' ;
54
- $ this ->messageKey = config ('api.message_key ' ) ?? 'message ' ;
52
+ if (function_exists ('config ' )) {
53
+ $ this ->errorKey = config ('api.error_message_key ' );
54
+ $ this ->errorDataKey = config ('api.error_data_key ' );
55
+ $ this ->messageKey = config ('api.message_key ' );
56
+ }
55
57
56
58
$ this ->response = $ response ;
57
59
$ this ->fractal = $ fractal ;
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ public function it_responds_with_error_and_optional_data()
189
189
$ this ->assertJson ($ response ->getContent ());
190
190
$ this ->assertJsonStringEqualsJsonString (json_encode ([
191
191
'error ' => 'Error! ' ,
192
- 'lazers ' => 'are cool ' ,
192
+ 'errors ' => [ ' lazers ' => 'are cool ' ] ,
193
193
'response_code ' => ApiResponseCode::INVALID_REQUEST
194
194
]), $ response ->getContent ());
195
195
$ this ->assertInstanceOf ('Illuminate\Http\JsonResponse ' , $ response );
You can’t perform that action at this time.
0 commit comments