fix(tests): reset EntityManager in ApiLeastPrivilegeTest to prevent stale references
This commit is contained in:
@@ -105,6 +105,19 @@ class ApiLeastPrivilegeTest extends ApiTestCase
|
||||
'app_insurance_insurance_list' => 'insurances.view',
|
||||
];
|
||||
|
||||
/**
|
||||
* این تست ~۱۳۰ درخواست پشتسرهم میزند و هر درخواست کرنل را دوباره بالا
|
||||
* میآورد، پس `$this->em` تا انتهای تست به یک نمونهٔ کهنه اشاره میکند. بدون
|
||||
* ریست، همان نمونه به تست بعدی ارث میرسد و آنجا — نه اینجا — میشکند.
|
||||
* (دقیقاً همان دامی که ApiTestCase::setUp برای «EntityManager is closed» بست.)
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
static::getContainer()->get('doctrine')->resetManager();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/** منشیای که هیچ مجوزی ندارد — همهٔ منابع رجیستری خاموش. */
|
||||
private function makePowerlessSecretary(): \App\Auth\Entity\User
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user