File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -646,14 +646,16 @@ public function pretend(Closure $callback)
646646 return $ this ->withFreshQueryLog (function () use ($ callback ) {
647647 $ this ->pretending = true ;
648648
649- // Basically to make the database connection "pretend", we will just return
650- // the default values for all the query methods, then we will return an
651- // array of queries that were "executed" within the Closure callback.
652- $ callback ($ this );
653-
654- $ this ->pretending = false ;
655-
656- return $ this ->queryLog ;
649+ try {
650+ // Basically to make the database connection "pretend", we will just return
651+ // the default values for all the query methods, then we will return an
652+ // array of queries that were "executed" within the Closure callback.
653+ $ callback ($ this );
654+
655+ return $ this ->queryLog ;
656+ } finally {
657+ $ this ->pretending = false ;
658+ }
657659 });
658660 }
659661
You can’t perform that action at this time.
0 commit comments