guardAgainstMissingEnv(); parent::setUp(); $this->registerCustomMacros(); $this->withoutMiddleware($this->globallyDisabledMiddleware); $this->initializeSettings(); // Flush the custom field filter map cache between tests so that // dynamically-created custom fields are always picked up fresh. Asset::flushCustomFieldFilterMap(); // Per-request memoization keyed by user id leaks across tests because // RefreshDatabase rolls back the DB but not PHP static state. Auto- // increment may hand the same id to a different test's user with a // different pivot set. Company::flushCompanyIdsCache(); } // ...existing code... private function guardAgainstMissingEnv(): void { if (! file_exists(realpath(__DIR__.'/../').'/.env.testing')) { throw new RuntimeException( '.env.testing file does not exist. Aborting to avoid wiping your local database.' ); } } }