Skip to content

Commit

Permalink
WB-623: refactor(fakeable): improve fakes cleanup method
Browse files Browse the repository at this point in the history
Reset process now uses dedicated cleanup functions for improved clarity and maintainability.
  • Loading branch information
deligoez committed Nov 6, 2024
1 parent 2705f83 commit 6965248
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Traits/Fakeable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}

Expand Down

0 comments on commit 6965248

Please sign in to comment.