File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
tests/Unit/Http/Middleware Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 3636 "YSRoot\\ SwaggerUI\\ " : " src/"
3737 }
3838 },
39+ "autoload-dev" : {
40+ "psr-4" : {
41+ "YSRoot\\ SwaggerUI\\ Tests\\ " : " tests"
42+ }
43+ },
3944 "minimum-stability" : " dev" ,
4045 "prefer-stable" : true
4146}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <phpunit backupGlobals =" false"
3+ backupStaticAttributes =" false"
4+ bootstrap =" vendor/autoload.php"
5+ colors =" true"
6+ convertErrorsToExceptions =" true"
7+ convertNoticesToExceptions =" true"
8+ convertWarningsToExceptions =" true"
9+ processIsolation =" false"
10+ stopOnFailure =" false"
11+ >
12+ <testsuites >
13+ <testsuite name =" Unit" >
14+ <directory suffix =" .php" >./tests/Unit</directory >
15+ </testsuite >
16+ </testsuites >
17+
18+ <php >
19+ <env name =" APP_KEY" value =" AckfSECXIvnK5r28GVIWUAxmbBSjTsmF" />
20+ </php >
21+ </phpunit >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace YSRoot \SwaggerUI \Tests \Unit \Http \Middleware ;
4+
5+ use Illuminate \Http \Request ;
6+ use Illuminate \Http \Response ;
7+ use Orchestra \Testbench \TestCase ;
8+ use YSRoot \SwaggerUI \Http \Middleware \EnsureIsAuthorized ;
9+
10+ class EnsureIsAuthorizedTest extends TestCase
11+ {
12+ public function testLocalEnvMiddlewarePassed (): void
13+ {
14+ $ this ->app ->detectEnvironment (fn () => 'local ' );
15+ $ request = Request::create ('not-important ' );
16+ $ expectedResult = new Response (['expected ' => 'expected ' ]);
17+ $ callback = fn () => $ expectedResult ;
18+
19+ $ result = (new EnsureIsAuthorized ())->handle ($ request , $ callback );
20+
21+ $ this ->assertEquals ($ expectedResult ->content (), $ result ->content ());
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments