File tree Expand file tree Collapse file tree
tests/Support/OperationExtensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -827,7 +827,6 @@ public function __invoke(Request $request)
827827 expect ($ document ['paths ' ]['/test ' ]['post ' ]['description ' ])
828828 ->toContain ('Cannot generate request documentation: Cannot evaluate validation rules ' );
829829});
830-
831830class CreateUser_RequestBodyExtensionTest extends FormRequest
832831{
833832 public function rules (): array
@@ -841,3 +840,38 @@ public function rules(): array
841840 ];
842841 }
843842}
843+
844+ it ('gracefully handles unpacked method call in form request ' , function () {
845+ $ document = generateForRoute (RouteFacade::post ('test ' , function (CreateUserUnpack_RequestBodyExtensionTest $ request ) {
846+ // ...
847+ }));
848+
849+ expect ($ document ['components ' ]['schemas ' ]['CreateUserUnpack_RequestBodyExtensionTest ' ])
850+ ->toBe ([
851+ 'type ' => 'object ' ,
852+ 'properties ' => [
853+ 'external_id ' => [
854+ 'type ' => 'string ' ,
855+ ]
856+ ],
857+ 'title ' => 'CreateUserUnpack_RequestBodyExtensionTest ' ,
858+ ]);
859+ });
860+ class CreateUserUnpack_RequestBodyExtensionTest extends FormRequest
861+ {
862+ public function rules (): array
863+ {
864+ return [
865+ 'external_id ' => [
866+ ...$ this ->someRules (),
867+ Rule::unique (\Dedoc \Scramble \Tests \Files \SamplePostModel::class)
868+ ->where ('company_id ' , $ this ->user ()->company_id ),
869+ ],
870+ ];
871+ }
872+
873+ protected function someRules ()
874+ {
875+ return ['numeric ' ];
876+ }
877+ }
You can’t perform that action at this time.
0 commit comments