Skip to content

[3.4-REFACTOR-6] Improve Base TestCase with seedApplicationSettings() Helper #1895

@Mawiguk0

Description

@Mawiguk0

Add a protected function seedApplicationSettings(): void helper to tests/TestCase.php. The method runs the RequiredDatabaseSeeder and marks the application as installed.

Middleware like LanguageSwitcher reads settings directly from the DB (Setting::where(…)->first()->value) and crashes during feature tests on a freshly migrated empty database. The helper must be called after parent::setUp() (so RefreshDatabase has already run migrations) and before the first request in any test that exercises HTTP middleware.

Metadata

Metadata

Assignees

Labels

phpPull requests that update Php coderefactor

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions