File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Rakutentech \LaravelRequestDocs \Tests ;
4
+
5
+ use Illuminate \Support \Facades \Route ;
6
+ use Rakutentech \LaravelRequestDocs \NotFoundWhenProduction ;
7
+
8
+ class NotFoundWhenProductionTest extends TestCase
9
+ {
10
+ public function testForbiddenInProduction ()
11
+ {
12
+ foreach (['prod ' , 'production ' ] as $ production ) {
13
+ app ()['env ' ] = $ production ;
14
+ Route::get ('middleware ' , function () {
15
+ return 1 ;
16
+ })->middleware (NotFoundWhenProduction::class);
17
+
18
+ $ this ->get ('middleware ' )
19
+ ->assertStatus (403 )
20
+ ->assertExactJson (['status ' => 'forbidden ' , 'status_code ' => 403 ]);
21
+ }
22
+ }
23
+
24
+ public function testMiddleware ()
25
+ {
26
+ Route::get ('middleware ' , function () {
27
+ return 1 ;
28
+ })->middleware (NotFoundWhenProduction::class);
29
+
30
+ $ this ->get ('middleware ' )
31
+ ->assertStatus (200 )
32
+ ->assertExactJson ([1 ]);
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments