From 6965248b16ba53e9554d5f2773741ac61a1f8671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yunus=20Emre=20Delig=C3=B6z?= Date: Wed, 6 Nov 2024 17:52:58 +0300 Subject: [PATCH] WB-623: refactor(fakeable): improve fakes cleanup method Reset process now uses dedicated cleanup functions for improved clarity and maintainability. --- src/Traits/Fakeable.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Traits/Fakeable.php b/src/Traits/Fakeable.php index 87dccf4..43b4828 100644 --- a/src/Traits/Fakeable.php +++ b/src/Traits/Fakeable.php @@ -100,14 +100,11 @@ public static function resetFakes(): void */ public static function resetAllFakes(): void { - foreach (array_keys(static::$fakes) as $class) { - if (App::has($class)) { - App::forgetInstance($class); - App::offsetUnset($class); - } + foreach (static::$fakes as $class => $mock) { + self::cleanupLaravelContainer(class: $class); + self::cleanupMockeryExpectations($mock); } - Mockery::resetContainer(); static::$fakes = []; }