@@ -21,6 +21,7 @@ protected function setUp(): void
2121 WithCustomPrefix::class,
2222 WithCustomMiddleware::class,
2323 WithCustomNamespace::class,
24+ WithoutGroup::class,
2425 ]);
2526
2627 parent ::setUp ();
@@ -62,15 +63,27 @@ public function test_can_use_custom_namespace()
6263 ],
6364 ]);
6465 }
66+
67+ public function test_routes_default_wrapped ()
68+ {
69+ $ this ->withoutExceptionHandling ()->getJson (route ('no.group.default.options ' ))
70+ ->assertStatus (200 )
71+ ->assertJson ([
72+ 'meta ' => [
73+ 'message ' => 'From the sayHello method ' ,
74+ ],
75+ ]);
76+ }
6577}
6678
6779class RepositoryWithRoutes extends Repository
6880{
6981 /**
7082 * @param Router $router
7183 * @param array $attributes
84+ * @param bool $wrap
7285 */
73- public static function routes (Router $ router , $ attributes )
86+ public static function routes (Router $ router , $ attributes, $ wrap = false )
7487 {
7588 $ router ->group ($ attributes , function ($ router ) {
7689 $ router ->get ('/main-testing ' , function () {
@@ -89,7 +102,7 @@ public static function uriKey()
89102
90103class WithCustomPrefix extends RepositoryWithRoutes
91104{
92- public static function routes (Router $ router , $ attributes )
105+ public static function routes (Router $ router , $ attributes, $ wrap = false )
93106 {
94107 $ attributes ['prefix ' ] = 'custom-prefix ' ;
95108
@@ -115,7 +128,7 @@ public function handle($request, $next)
115128
116129class WithCustomMiddleware extends RepositoryWithRoutes
117130{
118- public static function routes (Router $ router , $ options )
131+ public static function routes (Router $ router , $ options, $ wrap = false )
119132 {
120133 $ options ['middleware ' ] = [MiddlewareFail::class];
121134
@@ -131,7 +144,7 @@ public static function routes(Router $router, $options)
131144
132145class WithCustomNamespace extends RepositoryWithRoutes
133146{
134- public static function routes (Router $ router , $ options )
147+ public static function routes (Router $ router , $ options, $ wrap = false )
135148 {
136149 $ options ['namespace ' ] = 'Binaryk\LaravelRestify\Tests ' ;
137150
@@ -141,6 +154,14 @@ public static function routes(Router $router, $options)
141154 }
142155}
143156
157+ class WithoutGroup extends RepositoryWithRoutes
158+ {
159+ public static function routes (Router $ router , $ options = [], $ wrap = true )
160+ {
161+ $ router ->get ('default-options ' , '\\' .HandleController::class.'@sayHello ' )->name ('no.group.default.options ' );
162+ }
163+ }
164+
144165class HandleController extends RestController
145166{
146167 /**
0 commit comments