Skip to content

Commit 65f45fb

Browse files
committed
fix: add tearDown to clear event dispatcher after each test
- Add tearDown() method to ActiveRecordEdgeCasesTests to always clear event dispatcher - Prevents state leakage when testEventsWithDispatcherThrowingException throws exception - Ensures clean state for all subsequent tests - Fixes 28 failing tests in GitHub Actions
1 parent 5ec84a0 commit 65f45fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/shared/ActiveRecordEdgeCasesTests.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ protected function setUp(): void
101101
$connection->setEventDispatcher(null);
102102
}
103103

104+
protected function tearDown(): void
105+
{
106+
// Always clear event dispatcher after each test to prevent state leakage
107+
$queryBuilder = self::$db->find();
108+
$connection = $queryBuilder->getConnection();
109+
$connection->setEventDispatcher(null);
110+
111+
parent::tearDown();
112+
}
113+
104114
// ==================== ActiveRecord Edge Cases ====================
105115

106116
public function testNullValuesInAttributes(): void

0 commit comments

Comments
 (0)