@@ -689,4 +689,49 @@ function () {
689689 $ this ->assertRouteRegistered ('api.projects.users.batchDestroy ' , ['DELETE ' ], 'api/projects/{project}/users/batch ' , DummyController::class.'@batchDestroy ' );
690690 $ this ->assertRouteRegistered ('api.projects.users.batchRestore ' , ['POST ' ], 'api/projects/{project}/users/batch/restore ' , DummyController::class.'@batchRestore ' );
691691 }
692+
693+ /** @test */
694+ public function registering_resource_without_batch_removes_routes (): void
695+ {
696+ Route::group (
697+ ['as ' => 'api. ' , 'prefix ' => 'api ' ],
698+ function () {
699+ Orion::resource ('projects ' , DummyController::class)->withoutBatch ();
700+ }
701+ );
702+
703+ $ this ->assertRouteRegistered ('api.projects.search ' , ['POST ' ], 'api/projects/search ' , DummyController::class.'@search ' );
704+ $ this ->assertRouteRegistered ('api.projects.index ' , ['GET ' , 'HEAD ' ], 'api/projects ' , DummyController::class.'@index ' );
705+ $ this ->assertRouteRegistered ('api.projects.store ' , ['POST ' ], 'api/projects ' , DummyController::class.'@store ' );
706+ $ this ->assertRouteRegistered ('api.projects.show ' , ['GET ' , 'HEAD ' ], 'api/projects/{project} ' , DummyController::class.'@show ' );
707+ $ this ->assertRouteRegistered ('api.projects.update ' , ['PUT ' , 'PATCH ' ], 'api/projects/{project} ' , DummyController::class.'@update ' );
708+ $ this ->assertRouteRegistered ('api.projects.destroy ' , ['DELETE ' ], 'api/projects/{project} ' , DummyController::class.'@destroy ' );
709+
710+ $ this ->assertRouteNotRegistered ('api.projects.batchStore ' );
711+ $ this ->assertRouteNotRegistered ('api.projects.batchUpdate ' );
712+ $ this ->assertRouteNotRegistered ('api.projects.batchDestroy ' );
713+ }
714+
715+ /** @test */
716+ public function registering_resource_without_search_removes_routes (): void
717+ {
718+ Route::group (
719+ ['as ' => 'api. ' , 'prefix ' => 'api ' ],
720+ function () {
721+ Orion::resource ('projects ' , DummyController::class)->withoutSearch ();
722+ }
723+ );
724+
725+ $ this ->assertRouteNotRegistered ('api.projects.search ' );
726+
727+ $ this ->assertRouteRegistered ('api.projects.index ' , ['GET ' , 'HEAD ' ], 'api/projects ' , DummyController::class.'@index ' );
728+ $ this ->assertRouteRegistered ('api.projects.store ' , ['POST ' ], 'api/projects ' , DummyController::class.'@store ' );
729+ $ this ->assertRouteRegistered ('api.projects.show ' , ['GET ' , 'HEAD ' ], 'api/projects/{project} ' , DummyController::class.'@show ' );
730+ $ this ->assertRouteRegistered ('api.projects.update ' , ['PUT ' , 'PATCH ' ], 'api/projects/{project} ' , DummyController::class.'@update ' );
731+ $ this ->assertRouteRegistered ('api.projects.destroy ' , ['DELETE ' ], 'api/projects/{project} ' , DummyController::class.'@destroy ' );
732+
733+ $ this ->assertRouteRegistered ('api.projects.batchStore ' , ['POST ' ], 'api/projects/batch ' , DummyController::class.'@batchStore ' );
734+ $ this ->assertRouteRegistered ('api.projects.batchUpdate ' , ['PATCH ' ], 'api/projects/batch ' , DummyController::class.'@batchUpdate ' );
735+ $ this ->assertRouteRegistered ('api.projects.batchDestroy ' , ['DELETE ' ], 'api/projects/batch ' , DummyController::class.'@batchDestroy ' );
736+ }
692737}
0 commit comments