File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,7 @@ public function find($id): ?GlobalSet
3939 return (new $ global )->register ();
4040 }
4141
42- $ r = parent ::find ($ id );
43-
44- if ($ r ) {
45- return $ r ;
46- }
42+ return parent ::find ($ id );
4743 }
4844
4945 private function initializeGlobals ()
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Statamic \Facades \GlobalSet ;
4+ use Tests \TestCase ;
5+
6+ pest ()->extend (TestCase::class);
7+ test ('::find does not throw when no result is found ' , function (): void {
8+ GlobalSet::find ('id-that-does-not-exist ' );
9+ })->throwsNoExceptions ();
10+
11+ test ('::find returns null for nonexistent handles ' , function (): void {
12+ $ nullset = GlobalSet::find ('id-that-does-not-exist ' );
13+
14+ expect ($ nullset )->toBeNull ();
15+ });
You can’t perform that action at this time.
0 commit comments