Repository navigation
Tests: Add unit tests for wp_using_ext_object_cache() - #14452
shail-mehta wants to merge 1 commit into
Conversation
Adds coverage for reading and toggling the external object cache flag. See #65819.
There was a problem hiding this comment.
🟢 Approval recommended
The tests match the helper’s behavior, restore shared state, and have no identified blocking issues.
No open issues 🎉
What changed in this PR
Adds dedicated PHPUnit coverage for wp_using_ext_object_cache() without changing production code.
Changes:
- Tests reading the flag, setter return values, and repeated updates.
- Restores the original global flag during teardown to preserve test isolation.
| File | Description |
|---|---|
| tests/phpunit/tests/load/wpUsingExtObjectCache.php | Adds getter, setter, and idempotency tests with global-state cleanup. |
Review effort: Balanced
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
rejaulalomkhan
left a comment
There was a problem hiding this comment.
Thanks for working on this, @shail-mehta! Adding dedicated test coverage for wp_using_ext_object_cache() nicely covers the getter, setter return values, and idempotency behavior while preserving test isolation.
- Tested locally on trunk across single-site, multisite, and random order (
--order-by=random); all 3 tests and 15 assertions pass cleanly. - Verified
--group load(44 tests, 56 assertions) passes with no regressions. - PHPCS check on
tests/phpunit/tests/load/wpUsingExtObjectCache.phppasses with 0 errors and 0 warnings. - Global state cleanup in
tear_down()properly restores$_wp_using_ext_object_cache.
Looks good to merge!
AI Review: Antigravity
lancewillett
left a comment
There was a problem hiding this comment.
The tests verify previous-value returns and state transitions while restoring the original external-cache flag. No blocking findings.
Unit-tests audit and Copilot review found no blockers. PHPCS passed all ten files. The combined batch passed locally in randomized order: single-site 149 tests / 283 assertions (seed 65825), multisite 140 tests / 236 assertions (seed 65826). CI is green on the reviewed commit.
AI review · gpt-6
|
PR #14452 landed in https://core.trac.wordpress.org/changeset/64545 |
Verify reading the external-cache flag, previous-value setter returns, state transitions, and repeated assignments. Restore the original flag after each test. Developed in: #14452 Props shailu25, rejaulalomkhan. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64545 602fd350-edb4-49c9-b593-d223f7449a82
Verify reading the external-cache flag, previous-value setter returns, state transitions, and repeated assignments. Restore the original flag after each test. Developed in: WordPress/wordpress-develop#14452 Props shailu25, rejaulalomkhan. See #65819. Built from https://develop.svn.wordpress.org/trunk@64545 git-svn-id: http://core.svn.wordpress.org/trunk@63695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What
Trac ticket: #65819
Adds unit tests for
wp_using_ext_object_cache()intests/phpunit/tests/load/wpUsingExtObjectCache.php.Covers reading the current flag and setter behavior (returns previous value and updates
$_wp_using_ext_object_cache).Test-only change.
Why
This helper toggles external object cache usage across core and has had no dedicated PHPUnit coverage.
How
$_wp_using_ext_object_cacheintear_downTesting instructions
Use Of AI Tools