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

#[RequiresEnvironmentVariable] #6065

Closed
nikophil opened this issue Dec 2, 2024 · 2 comments
Closed

#[RequiresEnvironmentVariable] #6065

nikophil opened this issue Dec 2, 2024 · 2 comments
Labels
feature/metadata/attributes feature/test-runner CLI test runner type/enhancement A new idea that should be implemented
Milestone

Comments

@nikophil
Copy link
Contributor

nikophil commented Dec 2, 2024

Hello,

what do you think of adding a #[RequiresEnvVar] (or RequiresEnv?) attribute?

// would run the test if the env var is "truthy"
#[RequiresEnvVar('SOME_ENV_VAR')]
#[Test]
public function some_test(){}

// would run the test if the env var is strictly equals to 'foo'
#[RequiresEnvVar('SOME_ENV_VAR', value: 'foo')]
#[Test]
public function some_other_test(){}
@nikophil nikophil added the type/enhancement A new idea that should be implemented label Dec 2, 2024
@nikophil
Copy link
Contributor Author

nikophil commented Dec 4, 2024

Hi @sebastianbergmann

I saw you've added some labels (I don't know if thoses are automatic or not). If you're ok with this proposal, I'm willing to work on this 😊

@sebastianbergmann sebastianbergmann added this to the PHPUnit 12.0 milestone Dec 5, 2024
@sebastianbergmann
Copy link
Owner

Sorry, yes: feel free to work on this.

@sebastianbergmann sebastianbergmann changed the title introduce #[RequiresEnvVar] attribute #[RequiresEnvVar] Dec 7, 2024
@sebastianbergmann sebastianbergmann changed the title #[RequiresEnvVar] #[RequiresEnvironmentVariable] Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/metadata/attributes feature/test-runner CLI test runner type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants