Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide #[WithEnvironmentVariable()] attribute to set env variables #6116

Open
nikophil opened this issue Feb 4, 2025 · 1 comment · May be fixed by #6126
Open

Provide #[WithEnvironmentVariable()] attribute to set env variables #6116

nikophil opened this issue Feb 4, 2025 · 1 comment · May be fixed by #6126
Labels
feature/metadata/attributes type/enhancement A new idea that should be implemented

Comments

@nikophil
Copy link
Contributor

nikophil commented Feb 4, 2025

Hello,

would you accept a PR with a new attribute #[WithEnv('name', 'value')] or #[WithEnvironmentVariable('name', 'value')], which will set the given env var and run the test with this env?

This would allow to fully test applications which rely on environment variables for feature flags, for example. Relying on environment variables is quite common these days...

thanks for your answer

@nikophil nikophil added the type/enhancement A new idea that should be implemented label Feb 4, 2025
@sebastianbergmann
Copy link
Owner

Yes, I would consider a pull request for #[WithEnvironmentVariable('name', 'value')]. The effect of this attribute has to be limited to the scope of the test, of course.

@nikophil nikophil changed the title Provide #[WithEnv()] attribute to set env variables Provide #[WithEnvironmentVariable('name', 'value')] attribute to set env variables Feb 5, 2025
@nikophil nikophil changed the title Provide #[WithEnvironmentVariable('name', 'value')] attribute to set env variables Provide #[WithEnvironmentVariable()] attribute to set env variables Feb 5, 2025
@nikophil nikophil linked a pull request Feb 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/metadata/attributes type/enhancement A new idea that should be implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants