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

Refactor: Remove side effects from data provider #7478

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

pulsovi
Copy link
Contributor

@pulsovi pulsovi commented Aug 5, 2024

Issue

Tests_MISC_Functions->test_give_meta_helpers's data provider had side effects, which caused unexpected failures when using the --filter option of PHPUnit.

Solution

  • Removal of data provider side effects

Impact

This change improves test reliability and isolation, allowing more predictable execution, especially when using --filter.

Good practice

Data providers should never have side effects to guarantee the consistency and independence of the tests.

@jonwaldstein
Copy link
Contributor

@pulsovi thanks for the contribution! It appears our older automated tests are failing due to this change probably due to implementation update.

https://github.com/impress-org/givewp/actions/runs/10254681539/job/29133510148?pr=7478

David GABISON added 5 commits September 5, 2024 17:46
- Eliminated side effects in test_give_meta_helpers data provider
- Ensures consistent test environment regardless of --filter usage

This change prevents unexpected failures when running specific tests
with PHPUnit's --filter option.
double declaration of `add_filter('..._post_meta')` breaks the return
value. See test: Tests_MISC_Functions::test_give_meta_helpers
MyIsam engine does not support transactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants