File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -466,6 +466,54 @@ public function testCallPostWithParamsAndREQUEST()
466466 );
467467 }
468468
469+ public function testCallPutWithJsonRequest ()
470+ {
471+ $ this ->withRoutes ([
472+ [
473+ 'put ' ,
474+ 'home ' ,
475+ '\Tests\Support\Controllers\Popcorn::echoJson ' ,
476+ ],
477+ ]);
478+ $ data = [
479+ 'true ' => true ,
480+ 'false ' => false ,
481+ 'int ' => 2 ,
482+ 'null ' => null ,
483+ 'float ' => 1.23 ,
484+ 'string ' => 'foo ' ,
485+ ];
486+ $ response = $ this ->withBodyFormat ('json ' )
487+ ->call ('put ' , 'home ' , $ data );
488+
489+ $ response ->assertOK ();
490+ $ response ->assertJSONExact ($ data );
491+ }
492+
493+ public function testCallPutWithJsonRequestAndREQUEST ()
494+ {
495+ $ this ->withRoutes ([
496+ [
497+ 'put ' ,
498+ 'home ' ,
499+ static fn () => json_encode (Services::request ()->fetchGlobal ('request ' )),
500+ ],
501+ ]);
502+ $ data = [
503+ 'true ' => true ,
504+ 'false ' => false ,
505+ 'int ' => 2 ,
506+ 'null ' => null ,
507+ 'float ' => 1.23 ,
508+ 'string ' => 'foo ' ,
509+ ];
510+ $ response = $ this ->withBodyFormat ('json ' )
511+ ->call ('put ' , 'home ' , $ data );
512+
513+ $ response ->assertOK ();
514+ $ this ->assertStringContainsString ('[] ' , $ response ->getBody ());
515+ }
516+
469517 public function testCallWithJsonRequest ()
470518 {
471519 $ this ->withRoutes ([
You can’t perform that action at this time.
0 commit comments