File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1414
1515 Route::controller (UserController::class)->group (function () {
1616 Route::post ('users ' , 'create ' );
17- Route::put ('users/{id} ' , 'update ' );
18- Route::delete ('users/{id} ' , 'delete ' );
19- Route::get ('users/{id} ' , 'get ' );
17+ Route::put ('users/{id} ' , 'update ' )-> whereNumber ( ' id ' ) ;
18+ Route::delete ('users/{id} ' , 'delete ' )-> whereNumber ( ' id ' ) ;
19+ Route::get ('users/{id} ' , 'get ' )-> whereNumber ( ' id ' ) ;
2020 Route::get ('users ' , 'search ' );
2121 Route::get ('profile ' , 'profile ' );
2222 Route::put ('profile ' , 'updateProfile ' );
Original file line number Diff line number Diff line change @@ -260,6 +260,27 @@ public function testGet()
260260 $ this ->assertEqualsFixture ('get_user ' , $ response ->json ());
261261 }
262262
263+ public function testGetIdParamAsString ()
264+ {
265+ $ response = $ this ->actingAs (self ::$ admin )->json ('get ' , '/users/test ' );
266+
267+ $ response ->assertNotFound ();
268+ }
269+
270+ public function testPutIdParamAsString ()
271+ {
272+ $ response = $ this ->actingAs (self ::$ admin )->json ('put ' , '/users/test ' );
273+
274+ $ response ->assertNotFound ();
275+ }
276+
277+ public function testDeleteIdParamAsString ()
278+ {
279+ $ response = $ this ->actingAs (self ::$ admin )->json ('delete ' , '/users/test ' );
280+
281+ $ response ->assertNotFound ();
282+ }
283+
263284 public function testGetNotExists ()
264285 {
265286 $ response = $ this ->actingAs (self ::$ admin )->json ('get ' , '/users/0 ' );
You can’t perform that action at this time.
0 commit comments