diff --git a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php index 0daabf1ce139..c7de47afa797 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php +++ b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php @@ -184,6 +184,7 @@ protected function tearDownTheTestEnvironment(): void Queue::createPayloadUsing(null); RegisterProviders::flushState(); Sleep::fake(false); + Str::resetFactoryState(); TrimStrings::flushState(); TrustProxies::flushState(); TrustHosts::flushState(); diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 85995dba3714..07ac7a3cdf98 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -2088,4 +2088,16 @@ public static function flushCache() static::$camelCache = []; static::$studlyCache = []; } + + /** + * Return all factory functions to their default state. + * + * @return void + */ + public static function resetFactoryState() + { + static::createRandomStringsNormally(); + static::createUlidsNormally(); + static::createUuidsNormally(); + } }