Skip to content

Remove uopz PHP extension and refactor guard tests#12398

Open
officialasishkumar wants to merge 1 commit intogoogle:developfrom
officialasishkumar:infrastructure/12332-remove-uopz-extension
Open

Remove uopz PHP extension and refactor guard tests#12398
officialasishkumar wants to merge 1 commit intogoogle:developfrom
officialasishkumar:infrastructure/12332-remove-uopz-extension

Conversation

@officialasishkumar
Copy link
Copy Markdown

Summary

Addresses issue:

Relevant technical choices

CI workflows: Removed uopz from the PHP extension lists in both php-lint-tests.yml and gemini.yml. No tests depend on it after this change.

Test refactoring (Tag_Environment_Type_GuardTest): Replaced all uopz_set_static calls with filter-based assertions using the existing googlesitekit_allowed_tag_environment_types filter:

  • test_can_not_activate_when_environment_not_allowed: Filters allowed environments to exclude the current environment type, then asserts the guard rejects activation.
  • test_can_activate_when_environment_is_allowed: Filters allowed environments to include only the current environment type, then asserts the guard permits activation.

This approach tests the same guard logic without requiring any additional PHP extensions. A tear_down method clears the filter between tests to prevent leakage.

The two existing pre-5.5 / post-5.5 WP version tests are preserved unchanged.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Drop the uopz extension from the php-lint-tests and gemini CI
workflows as no tests depend on it after this change.

Refactor Tag_Environment_Type_GuardTest to use the existing
googlesitekit_allowed_tag_environment_types filter instead of
uopz_set_static for mocking the environment type. This makes
the tests portable across all PHP versions without requiring
any additional extensions.
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.

1 participant