Skip to content

Commit 10571be

Browse files
feat: disable fieldsets by default (#262)
* feat: disable fieldsets by default * test: take new changes into account
1 parent 5312936 commit 10571be

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

config/fractal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
*
6363
* NOTE: This feature does not work if the "resource name" is not set.
6464
*/
65-
'enabled' => true,
65+
'enabled' => false,
6666

6767
/*
6868
* The name of key in the request, where we should look for the fieldsets to parse.

tests/AutoFieldsetsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Illuminate\Testing\Fluent\AssertableJson;
44

55
it('returns only requested fields', function ($fields, $expectedMissing) {
6+
config()->set('fractal.auto_fieldsets.enabled', true);
67
$response = $this->call('GET', '/auto-fieldsets-with-resource-name', [
78
'fields' => [
89
'books' => $fields,
@@ -27,6 +28,7 @@
2728
]);
2829

2930
it('doesnt work if "resource name" is not set', function ($fields) {
31+
config()->set('fractal.auto_fieldsets.enabled', true);
3032
$response = $this->call('GET', '/auto-fieldsets-without-resource-name', [
3133
'fields' => [
3234
'books' => $fields,
@@ -50,6 +52,7 @@
5052
]);
5153

5254
it('all fields are present when parameter is not passed', function () {
55+
config()->set('fractal.auto_fieldsets.enabled', true);
5356
$response = $this->call('GET', '/auto-fieldsets-with-resource-name', [
5457
'include' => 'characters',
5558
]);
@@ -86,6 +89,7 @@
8689
});
8790

8891
it('uses the configured request key', function () {
92+
config()->set('fractal.auto_fieldsets.enabled', true);
8993
config()->set('fractal.auto_fieldsets.request_key', 'other_fields');
9094
$response = $this->call('GET', '/auto-fieldsets-with-resource-name', [
9195
'fields' => [

0 commit comments

Comments
 (0)