File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 16
16
* @link https://github.com/MarcinOrlowski/laravel-api-response-builder
17
17
*/
18
18
19
+ use Illuminate \Http \JsonResponse ;
19
20
use MarcinOrlowski \PhpunitExtraAsserts \Generator ;
20
21
use MarcinOrlowski \ResponseBuilder \BaseApiCodes ;
21
22
use MarcinOrlowski \ResponseBuilder \Builder ;
@@ -89,4 +90,15 @@ public function testErrorWithOkCode(): void
89
90
RB ::asError (BaseApiCodes::OK ());
90
91
}
91
92
93
+ /**
94
+ * Checksi if explicit @null as HTTP code falls back to default HTTP error code..
95
+ */
96
+ public function testErrorWithNullHttpCode (): void
97
+ {
98
+ $ apiCode = BaseApiCodes::getMinCode ();
99
+ $ response = RB ::error ($ apiCode , http_code: null );
100
+ $ this ->assertInstanceOf (JsonResponse::class, $ response );
101
+ $ this ->assertEquals (RB ::DEFAULT_HTTP_CODE_ERROR , $ response ->getStatusCode ());
102
+ }
103
+
92
104
} // end of class
You can’t perform that action at this time.
0 commit comments