File tree 2 files changed +15
-0
lines changed
tests/Feature/Controllers
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ class MutateRequest extends RestRequest
17
17
public function rules ()
18
18
{
19
19
return [
20
+ 'mutate ' => ['required ' ],
20
21
'mutate.* ' => new MutateRules (
21
22
$ this ->route ()->controller ::newResource (),
22
23
$ this ,
Original file line number Diff line number Diff line change @@ -41,6 +41,20 @@ public function test_creating_a_resource_using_not_authorized_field(): void
41
41
$ response ->assertJsonStructure (['message ' , 'errors ' => ['mutate.0.attributes ' ]]);
42
42
}
43
43
44
+ public function test_creating_a_resource_using_no_mutate_key (): void
45
+ {
46
+ Gate::policy (Model::class, GreenPolicy::class);
47
+
48
+ $ response = $ this ->post (
49
+ '/api/models/mutate ' ,
50
+ [],
51
+ ['Accept ' => 'application/json ' ]
52
+ );
53
+
54
+ $ response ->assertStatus (422 );
55
+ $ response ->assertJsonStructure (['message ' , 'errors ' => ['mutate ' ]]);
56
+ }
57
+
44
58
public function test_creating_a_resource_using_not_authorized_attach_root_operator (): void
45
59
{
46
60
Gate::policy (Model::class, GreenPolicy::class);
You can’t perform that action at this time.
0 commit comments