Skip to content

Commit

Permalink
WB-623: test(tests): add test for cleaning Mockery container during f…
Browse files Browse the repository at this point in the history
…ake reset

Add a test to ensure that the Mockery container is cleaned when all fakes are reset in InvokableBehaviorFakeTest.php.
  • Loading branch information
deligoez committed Nov 5, 2024
1 parent 72b79d4 commit 892c3cf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/InvokableBehaviorFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,20 @@ public function __invoke(ContextManager $context): bool
expect(app()->bound(TestIncrementAction::class))->toBeFalse()
->and(app()->bound(TestCountGuard::class))->toBeFalse();
});

it('cleans mockery container when resetting fakes', function (): void {
// 1. Arrange
TestIncrementAction::shouldRun()->once();
TestCountGuard::shouldRun()->twice();

// 2. Act
EventMachine::resetAllFakes();

// 3. Assert
TestIncrementAction::shouldRun()->never();
TestIncrementAction::assertNotRan();

TestCountGuard::shouldRun()->never();
TestCountGuard::assertNotRan();
});
// endregion

0 comments on commit 892c3cf

Please sign in to comment.