additional tests
Related to #3581790
● All 12 tests pass, all linting is clean. Here's what was added:
DotenvServiceProviderTest — 3 new test methods:
- testFallbackWhenAppEnvUnset — truly unsets $_ENV['APP_ENV'] (vs the original test which set it to null)
- testDoesNotOverwriteExistingProjectDir — verifies the hasParameter guard for dotenv.project_dir
- testDoesNotOverwriteExistingEnvironment — verifies the hasParameter guard for dotenv.environment
DotenvInitCommandTest — new file with 7 tests:
- testInitAbortsWhenDotEnvExists — early return when .env exists
- testInitAbortsWhenDotEnvExampleExists — early return when .env.example exists
- testInitAbortsWhenSettingsPhpMissing — early return when settings.php missing
- testInitCreatesEnvFiles — happy path creating both files
- testInitAddsGitignore — --add-gitignore appends to existing .gitignore
- testInitGitignoreWarnsWhenMissing — warns when .gitignore doesn't exist
- testInitLoaderWarnsWhenComposerJsonMissing — copies loader file, warns about missing composer.json
The --database-settings option and the full --add-loader happy path (modifying composer.json + running composer dump-autoload) remain untested since they require mocking Database::getConnectionInfo() and the Drush process manager respectively — doable but heavier lift if you want those later.