File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
tests/Feature/Controllers Expand file tree Collapse file tree 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
1717 public function rules ()
1818 {
1919 return [
20+ 'mutate ' => ['required ' ],
2021 'mutate.* ' => new MutateRules (
2122 $ this ->route ()->controller ::newResource (),
2223 $ 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
4141 $ response ->assertJsonStructure (['message ' , 'errors ' => ['mutate.0.attributes ' ]]);
4242 }
4343
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+
4458 public function test_creating_a_resource_using_not_authorized_attach_root_operator (): void
4559 {
4660 Gate::policy (Model::class, GreenPolicy::class);
You can’t perform that action at this time.
0 commit comments