Skip to content

Commit fbda5d0

Browse files
committed
Use default global filters in feature tests
1 parent 20c1ae9 commit fbda5d0

29 files changed

Lines changed: 96 additions & 224 deletions

tests/Http/Api/ApiDashboardControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function buildWidgetsData(): void
5353
});
5454

5555
$this
56-
->getJson('/sharp/api/root/dashboard/'.DashboardEntity::$entityKey, headers: [
56+
->getJson(route('code16.sharp.api.dashboard', DashboardEntity::$entityKey), headers: [
5757
SharpBreadcrumb::CURRENT_PAGE_URL_HEADER => url('/sharp/root/s-list/person/s-show/person/1'),
5858
])
5959
->assertOk()

tests/Http/Api/ApiEntityListControllerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function reorder(array $ids): void
4444

4545
$this
4646
->postJson(
47-
route('code16.sharp.api.list.reorder', ['root', 'person']),
47+
route('code16.sharp.api.list.reorder', ['person']),
4848
['instances' => [3, 2, 1]]
4949
)
5050
->assertOk();
@@ -65,7 +65,7 @@ public function delete($id): void
6565
}
6666
});
6767

68-
$this->deleteJson(route('code16.sharp.api.list.delete', ['root', 'person', 1]))
68+
$this->deleteJson(route('code16.sharp.api.list.delete', ['person', 1]))
6969
->assertOk();
7070

7171
expect($deletedId)->toEqual(1);
@@ -84,7 +84,7 @@ public function delete($id): void
8484
}
8585
});
8686

87-
$this->deleteJson(route('code16.sharp.api.list.delete', ['root', 'person', 1]))
87+
$this->deleteJson(route('code16.sharp.api.list.delete', ['person', 1]))
8888
->assertOk();
8989

9090
expect($deletedId)->toEqual(1);
@@ -107,14 +107,14 @@ public function delete($user, $instanceId): bool
107107
}
108108
});
109109

110-
$this->deleteJson(route('code16.sharp.api.list.delete', ['root', 'person', 1]))
110+
$this->deleteJson(route('code16.sharp.api.list.delete', ['person', 1]))
111111
->assertForbidden();
112112
});
113113

114114
it('throws an exception if delete is not implemented and there is no show', function () {
115115
fakeShowFor('person', null);
116116

117-
$this->deleteJson(route('code16.sharp.api.list.delete', ['root', 'person', 1]))
117+
$this->deleteJson(route('code16.sharp.api.list.delete', ['person', 1]))
118118
->assertStatus(500);
119119
});
120120

tests/Http/Api/ApiFilterAutocompleteTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public function valueLabelFor(string $id): string
4949

5050
$this
5151
->postJson(route('code16.sharp.api.filters.autocomplete.index', [
52-
'globalFilter' => 'root',
5352
'entityKey' => 'person',
5453
'filterHandlerKey' => 'test',
5554
]), [
@@ -100,7 +99,6 @@ public function valueLabelFor(string $id): string
10099

101100
$this
102101
->postJson(route('code16.sharp.api.filters.autocomplete.index', [
103-
'globalFilter' => 'root',
104102
'entityKey' => 'person',
105103
'filterHandlerKey' => 'test',
106104
]), [
@@ -152,7 +150,6 @@ public function valueLabelFor(string $id): string
152150

153151
$this
154152
->postJson(route('code16.sharp.api.filters.autocomplete.index', [
155-
'globalFilter' => 'root',
156153
'entityKey' => 'dashboard',
157154
'filterHandlerKey' => 'test',
158155
]), [

tests/Http/Api/ApiFormAutocompleteControllerTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public function buildFormFields(FieldsContainer $formFields): void
4444

4545
$this
4646
->postJson(route('code16.sharp.api.form.autocomplete.index', [
47-
'globalFilter' => 'root',
4847
'entityKey' => 'person',
4948
'autocompleteFieldKey' => 'autocomplete_field',
5049
]), [
@@ -79,7 +78,6 @@ public function buildFormFields(FieldsContainer $formFields): void
7978

8079
$this
8180
->postJson(route('code16.sharp.api.form.autocomplete.index', [
82-
'globalFilter' => 'root',
8381
'entityKey' => 'person',
8482
'autocompleteFieldKey' => 'autocomplete_field',
8583
]), [
@@ -120,7 +118,6 @@ public function buildFormFields(FieldsContainer $formFields): void
120118

121119
$this
122120
->postJson(route('code16.sharp.api.form.autocomplete.index', [
123-
'globalFilter' => 'root',
124121
'entityKey' => 'person',
125122
'autocompleteFieldKey' => 'list.autocomplete_field',
126123
'formData' => [
@@ -162,7 +159,6 @@ public function buildFormFields(FieldsContainer $formFields): void
162159

163160
$this
164161
->postJson(route('code16.sharp.api.form.autocomplete.index', [
165-
'globalFilter' => 'root',
166162
'entityKey' => 'person',
167163
'autocompleteFieldKey' => 'autocomplete_field',
168164
]), [
@@ -202,7 +198,6 @@ public function buildFormFields(FieldsContainer $formFields): void
202198

203199
$this
204200
->postJson(route('code16.sharp.api.form.autocomplete.index', [
205-
'globalFilter' => 'root',
206201
'entityKey' => 'person',
207202
'autocompleteFieldKey' => 'autocomplete_field',
208203
]), [
@@ -239,7 +234,6 @@ public function buildFormFields(FieldsContainer $formFields): void
239234

240235
$this
241236
->postJson(route('code16.sharp.api.form.autocomplete.index', [
242-
'globalFilter' => 'root',
243237
'entityKey' => 'person',
244238
'autocompleteFieldKey' => 'autocomplete_field',
245239
]), [
@@ -276,7 +270,6 @@ public function buildFormFields(FieldsContainer $formFields): void
276270

277271
$this
278272
->postJson(route('code16.sharp.api.form.autocomplete.index', [
279-
'globalFilter' => 'root',
280273
'entityKey' => 'person',
281274
'autocompleteFieldKey' => 'autocomplete_field',
282275
]), [
@@ -319,7 +312,6 @@ public function getNameAndJob(): string
319312

320313
$this
321314
->postJson(route('code16.sharp.api.form.autocomplete.index', [
322-
'globalFilter' => 'root',
323315
'entityKey' => 'person',
324316
'autocompleteFieldKey' => 'autocomplete_field',
325317
]), [
@@ -354,7 +346,6 @@ public function buildFormFields(FieldsContainer $formFields): void
354346

355347
$this
356348
->postJson(route('code16.sharp.api.form.autocomplete.index', [
357-
'globalFilter' => 'root',
358349
'entityKey' => 'person',
359350
'autocompleteFieldKey' => 'autocomplete_field',
360351
]), [
@@ -385,7 +376,6 @@ public function buildFormFields(FieldsContainer $formFields): void
385376

386377
$this
387378
->postJson(route('code16.sharp.api.form.autocomplete.index', [
388-
'globalFilter' => 'root',
389379
'entityKey' => 'person',
390380
'autocompleteFieldKey' => 'autocomplete_field',
391381
]));
@@ -406,7 +396,6 @@ public function buildFormFields(FieldsContainer $formFields): void
406396

407397
$this
408398
->postJson(route('code16.sharp.api.form.autocomplete.index', [
409-
'globalFilter' => 'root',
410399
'entityKey' => 'person',
411400
'autocompleteFieldKey' => 'name',
412401
]));
@@ -432,7 +421,6 @@ public function buildFormFields(FieldsContainer $formFields): void
432421

433422
$this
434423
->postJson(route('code16.sharp.api.form.autocomplete.index', [
435-
'globalFilter' => 'root',
436424
'entityKey' => 'person',
437425
'autocompleteFieldKey' => 'autocomplete_field',
438426
]), [
@@ -460,7 +448,6 @@ public function buildFormFields(FieldsContainer $formFields): void
460448

461449
$this
462450
->postJson(route('code16.sharp.api.form.autocomplete.index', [
463-
'globalFilter' => 'root',
464451
'entityKey' => 'person',
465452
'autocompleteFieldKey' => 'autocomplete_field',
466453
]), [
@@ -494,7 +481,6 @@ public function buildFormFields(FieldsContainer $formFields): void
494481
foreach (['/my/endpoint', url('/my/endpoint')] as $endpoint) {
495482
$this
496483
->postJson(route('code16.sharp.api.form.autocomplete.index', [
497-
'globalFilter' => 'root',
498484
'entityKey' => 'person',
499485
'autocompleteFieldKey' => 'autocomplete_field',
500486
]), [
@@ -505,7 +491,6 @@ public function buildFormFields(FieldsContainer $formFields): void
505491

506492
$this
507493
->postJson(route('code16.sharp.api.form.autocomplete.index', [
508-
'globalFilter' => 'root',
509494
'entityKey' => 'person',
510495
'autocompleteFieldKey' => 'autocomplete_full_field',
511496
]), [
@@ -533,7 +518,6 @@ public function buildFormFields(FieldsContainer $formFields): void
533518

534519
$this
535520
->postJson(route('code16.sharp.api.form.autocomplete.index', [
536-
'globalFilter' => 'root',
537521
'entityKey' => 'person',
538522
'autocompleteFieldKey' => 'autocomplete_field',
539523
]), [
@@ -560,7 +544,6 @@ public function buildFormFields(FieldsContainer $formFields): void
560544

561545
$this
562546
->postJson(route('code16.sharp.api.form.autocomplete.index', [
563-
'globalFilter' => 'root',
564547
'entityKey' => 'person',
565548
'autocompleteFieldKey' => 'autocomplete_field',
566549
]), [
@@ -587,7 +570,6 @@ public function buildFormFields(FieldsContainer $formFields): void
587570

588571
$this
589572
->postJson(route('code16.sharp.api.form.autocomplete.index', [
590-
'globalFilter' => 'root',
591573
'entityKey' => 'person',
592574
'autocompleteFieldKey' => 'autocomplete_field',
593575
]), [
@@ -614,7 +596,6 @@ public function buildFormFields(FieldsContainer $formFields): void
614596

615597
$this
616598
->postJson(route('code16.sharp.api.form.autocomplete.index', [
617-
'globalFilter' => 'root',
618599
'entityKey' => 'person',
619600
'autocompleteFieldKey' => 'autocomplete_field',
620601
]), [
@@ -642,7 +623,6 @@ public function buildFormFields(FieldsContainer $formFields): void
642623

643624
$this
644625
->postJson(route('code16.sharp.api.form.autocomplete.index', [
645-
'globalFilter' => 'root',
646626
'entityKey' => 'person',
647627
'autocompleteFieldKey' => 'autocomplete_field',
648628
]), [
@@ -676,7 +656,6 @@ public function buildFormFields(FieldsContainer $formFields): void
676656

677657
$this
678658
->postJson(route('code16.sharp.api.form.autocomplete.index', [
679-
'globalFilter' => 'root',
680659
'entityKey' => 'person',
681660
'autocompleteFieldKey' => 'autocomplete_field',
682661
'embed_key' => (new ApiFormAutocompleteControllerAutocompleteEmbed())->key(),
@@ -729,7 +708,6 @@ public function execute(mixed $instanceId, array $data = []): array {}
729708

730709
$this
731710
->postJson(route('code16.sharp.api.form.autocomplete.index', [
732-
'globalFilter' => 'root',
733711
'entityKey' => 'person',
734712
'autocompleteFieldKey' => 'autocomplete_field',
735713
'instance_id' => 1,
@@ -783,7 +761,6 @@ public function execute(array $data = []): array {}
783761

784762
$this
785763
->postJson(route('code16.sharp.api.form.autocomplete.index', [
786-
'globalFilter' => 'root',
787764
'entityKey' => 'person',
788765
'autocompleteFieldKey' => 'autocomplete_field',
789766
'entity_list_command_key' => 'my-command',
@@ -836,7 +813,6 @@ protected function executeSingle(array $data): array {}
836813

837814
$this
838815
->postJson(route('code16.sharp.api.form.autocomplete.index', [
839-
'globalFilter' => 'root',
840816
'entityKey' => 'person',
841817
'autocompleteFieldKey' => 'autocomplete_field',
842818
'instance_id' => 1,
@@ -890,7 +866,6 @@ protected function executeSingle(array $data): array {}
890866

891867
$this
892868
->postJson(route('code16.sharp.api.form.autocomplete.index', [
893-
'globalFilter' => 'root',
894869
'entityKey' => 'person',
895870
'autocompleteFieldKey' => 'autocomplete_field',
896871
'show_command_key' => 'my-command',
@@ -948,7 +923,6 @@ public function execute(mixed $instanceId, array $data = []): array {}
948923

949924
$this
950925
->postJson(route('code16.sharp.api.form.autocomplete.index', [
951-
'globalFilter' => 'root',
952926
'entityKey' => 'person',
953927
'autocompleteFieldKey' => 'autocomplete_field',
954928
'instance_id' => 1,

tests/Http/Api/ApiFormRefreshControllerTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function update(mixed $id, array $data) {}
4646

4747
$this->post(
4848
route('code16.sharp.api.form.refresh.update', [
49-
'globalFilter' => 'root',
5049
'entityKey' => 'person',
5150
'instance_id' => 1,
5251
]),
@@ -97,7 +96,6 @@ public function execute(array $data = []): array
9796

9897
$this->post(
9998
route('code16.sharp.api.form.refresh.update', [
100-
'globalFilter' => 'root',
10199
'entityKey' => 'person',
102100
'entity_list_command_key' => 'cmd',
103101
]),
@@ -148,7 +146,6 @@ public function execute(mixed $instanceId, array $data = []): array
148146

149147
$this->post(
150148
route('code16.sharp.api.form.refresh.update', [
151-
'globalFilter' => 'root',
152149
'entityKey' => 'person',
153150
'entity_list_command_key' => 'cmd',
154151
'instance_id' => 1,
@@ -200,7 +197,6 @@ public function execute(mixed $instanceId, array $data = []): array
200197

201198
$this->post(
202199
route('code16.sharp.api.form.refresh.update', [
203-
'globalFilter' => 'root',
204200
'entityKey' => 'person',
205201
'show_command_key' => 'cmd',
206202
'instance_id' => 1,
@@ -230,7 +226,6 @@ public function execute(mixed $instanceId, array $data = []): array
230226
$this
231227
->postJson(
232228
route('code16.sharp.api.form.refresh.update', [
233-
'globalFilter' => 'root',
234229
'entityKey' => 'person',
235230
'embed_key' => (new ApiFormRefreshControllerEmbed())->key(),
236231
]),

tests/Http/Api/ApiFormUploadThumbnailControllerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
->storeAs('data/Posts/1', 'image.jpg', ['disk' => 'local']);
1515

1616
$this->postJson(route('code16.sharp.api.form.upload.thumbnail.show', [
17-
'globalFilter' => 'root',
1817
'entityKey' => 'person',
1918
'instanceId' => '1',
2019
'path' => 'data/Posts/1/image.jpg',

tests/Http/Api/Commands/ApiDashboardCommandControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Code16\Sharp\Utils\Fields\FieldsContainer;
88

99
beforeEach(function () {
10-
sharp()->config()->addEntity('dashboard', DashboardEntity::class);
10+
sharp()->config()->declareEntity(DashboardEntity::class);
1111
login();
1212
});
1313

@@ -35,7 +35,7 @@ public function execute(array $data = []): array
3535

3636
$this->withoutExceptionHandling();
3737

38-
$this->postJson(route('code16.sharp.api.dashboard.command', ['root', 'dashboard', 'info']))
38+
$this->postJson(route('code16.sharp.api.dashboard.command', ['dashboard', 'info']))
3939
->assertOk()
4040
->assertJson([
4141
'action' => 'info',
@@ -84,7 +84,7 @@ public function initialData(): array
8484
});
8585

8686
$this
87-
->getJson(route('code16.sharp.api.dashboard.command.form', ['root', 'dashboard', 'command_with_init_data']))
87+
->getJson(route('code16.sharp.api.dashboard.command.form', ['dashboard', 'command_with_init_data']))
8888
->assertOk()
8989
->assertJsonFragment([
9090
'data' => [

0 commit comments

Comments
 (0)