File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ class Frontier
1111{
1212 public static function add (array $ config ): void
1313 {
14+ if (empty ($ config ['enabled ' ])) {
15+ return ;
16+ }
17+
1418 match ($ config ['type ' ]) {
1519 'http ' => self ::http ($ config ),
1620 'proxy ' => self ::proxy ($ config ),
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Dex \Laravel \Frontier \Frontier ;
6+ use Illuminate \Support \Facades \Http ;
7+
8+ test ('assert not found when Frontier is disabled ' , function () {
9+ Frontier::add ([
10+ 'enabled ' => false ,
11+ 'type ' => 'proxy ' ,
12+ 'host ' => 'frontier.test ' ,
13+ 'rules ' => [
14+ '/disabled::exact ' ,
15+ ],
16+ ]);
17+
18+ Http::fake ([
19+ 'frontier.test/disabled ' => Http::response ('Frontier is disabled ' ),
20+ ]);
21+
22+ $ this ->get ('disabled ' )
23+ ->assertNotFound ();
24+ });
You can’t perform that action at this time.
0 commit comments