Skip to content

Commit dab963b

Browse files
committed
WB-1389: test(invokablebehaviorfaketest): refine fake reset tests for isolation and consistency
Improve test clarity by consolidating assertions for fake isolation and consistency after resets. Remove redundant comments and streamline test structure for better readability.
1 parent c24503a commit dab963b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

tests/InvokableBehaviorFakeTest.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -420,37 +420,29 @@ public function __invoke(ContextManager $context): bool
420420
TestCountGuard::assertNotRan();
421421
});
422422

423-
it('maintains behavior isolation after resetting all fakes', function (): void {
424-
// 1. Arrange
423+
it('maintains behavior isolation and consistency after resetting fakes', function (): void {
424+
// Test isolation after reset
425425
TestIncrementAction::shouldRun()->once();
426426
TestCountGuard::shouldRun()->twice();
427427
EventMachine::resetAllFakes();
428428

429-
// 2. Act
430429
TestIncrementAction::shouldRun()->once();
431430
TestIncrementAction::run(new ContextManager(['count' => 0]));
432431

433-
// 3. Assert
434432
TestIncrementAction::assertRan();
435433
expect(TestCountGuard::isFaked())->toBeFalse();
436-
});
437434

438-
it('can reset fakes with different trait instances consistently', function (): void {
439-
// 1. Arrange
435+
// Test consistent reset with different trait instances
440436
TestIncrementAction::shouldRun()->once();
441437
TestCountGuard::shouldRun()->twice();
442438

443-
// 2. Act
444439
TestIncrementAction::resetAllFakes();
445440

446-
// Try to create new fakes
447441
TestIncrementAction::shouldRun()->once();
448442
TestCountGuard::shouldRun()->once();
449443

450-
// Reset using another instance
451444
TestCountGuard::resetAllFakes();
452445

453-
// 3. Assert
454446
expect(TestIncrementAction::isFaked())->toBeFalse()
455447
->and(TestCountGuard::isFaked())->toBeFalse()
456448
->and(TestIncrementAction::getFake())->toBeNull()

0 commit comments

Comments
 (0)