@@ -684,9 +684,23 @@ public function testAddDataWithNotExistsMethodOnController()
684684 $ service ->addData ($ request , $ response );
685685 }
686686
687- public function testAddDataWithBindingInterface ()
687+ public static function addDataWithBindingInterface (): array
688688 {
689- $ this ->app ->bind (TestContract::class, TestRequest::class);
689+ return [
690+ [
691+ 'concrete ' => TestRequest::class,
692+ ],
693+ [
694+ 'concrete ' => fn ($ app ) => new TestRequest (),
695+ ],
696+ ];
697+ }
698+
699+ #[DataProvider('addDataWithBindingInterface ' )]
700+ public function testAddDataWithBindingInterface ($ concrete )
701+ {
702+ $ this ->app ->bind (TestContract::class, $ concrete );
703+
690704 $ this ->mockDriverGetEmptyAndSaveProcessTmpData ($ this ->getJsonFixture ('tmp_data_get_user_request ' ));
691705
692706 $ service = app (SwaggerService::class);
@@ -875,44 +889,4 @@ public function testAddDataWhenInvokableClass()
875889
876890 app (SwaggerService::class)->addData ($ request , $ response );
877891 }
878-
879- public function testAddDataWhenInvokableClassWithBindingContractToObject ()
880- {
881- $ this ->mockDriverGetEmptyAndSaveProcessTmpData ($ this ->getJsonFixture ('tmp_data_get_user_request_invoke_bind_closure ' ));
882-
883- $ this ->app ->bind (TestRequestContract::class, fn () => new TestRequest ());
884-
885- $ request = $ this ->generateRequest (
886- type: 'get ' ,
887- uri: 'users ' ,
888- controllerMethod: '__invoke ' ,
889- controllerClass: InvokableTestController::class,
890- );
891-
892- $ response = $ this ->generateResponse ('example_success_user_response.json ' , 200 , [
893- 'Content-type ' => 'application/json ' ,
894- ]);
895-
896- app (SwaggerService::class)->addData ($ request , $ response );
897- }
898-
899- public function testAddDataWhenInvokableClassWithBindingContractToClassName ()
900- {
901- $ this ->mockDriverGetEmptyAndSaveProcessTmpData ($ this ->getJsonFixture ('tmp_data_get_user_request_invoke_bind_closure ' ));
902-
903- $ this ->app ->bind (TestRequestContract::class, TestRequest::class);
904-
905- $ request = $ this ->generateRequest (
906- type: 'get ' ,
907- uri: 'users ' ,
908- controllerMethod: '__invoke ' ,
909- controllerClass: InvokableTestController::class,
910- );
911-
912- $ response = $ this ->generateResponse ('example_success_user_response.json ' , 200 , [
913- 'Content-type ' => 'application/json ' ,
914- ]);
915-
916- app (SwaggerService::class)->addData ($ request , $ response );
917- }
918892}
0 commit comments