You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new PHPUnit test file is added to check the functionality of the wp_spaces_regexp function in a WordPress application. These tests verify the return value of the function with given input and confirm the filter instantiation calls.
A new PHPUnit test file is added to check the functionality of the wp_spaces_regexp function in a WordPress application. These tests verify the return value of the function with given input and confirm the filter instantiation calls.
The changes in this pull request can previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.
Some things to be aware of
The Plugin and Theme Directories cannot be accessed within Playground.
All changes will be lost when closing a tab with a Playground instance.
All changes will be lost when refreshing the page.
A fresh instance is created each time the link below is clicked.
Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.
The reason will be displayed to describe this comment to others. Learn more.
The filter assertion only confirms that bootstrap already populated the static cache, and the exact regex string couples the test to implementation. Existing texturize checks cover whitespace behavior. Please identify a distinct behavioral regression before adding this check; no larger matrix is needed.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The isolated test still runs the WordPress bootstrap, which populates the regex cache before filter registration, causing the assertion to receive the default pattern and leaving the filter untested.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The test fails to warm the current process’s cache before registering the mock, so correct cold-cache behavior can invoke the filter and fail the zero-call assertion.
This test attaches the mock without first populating the current process's static cache; the cold-start test populates only its subprocess's cache. If no earlier call has warmed the cache, the call on line 47 invokes the filter and the zero-call assertion fails despite correct behavior. Call wp_spaces_regexp() before registering the mock so the test establishes its own warmed-cache precondition.
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the cold-start test answers my question: it's the only test that catches wp_spaces_regexp() ignoring its filter, and it also catches a lost static cache. The class passes in randomized single-site and multisite runs alongside the wptexturize() tests.
existing wptexturize() data sets (#4–#7), warmed-cache test
Its exact-string check duplicates the wptexturize() coverage and fails on any intentional pattern change. Its call-count check duplicates the cold-start test. Please remove it and keep the cold-start test.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The test unconditionally calls potentially disabled exec(), breaks valid pre-escaped WP_PHP_BINARY commands, and leaves the default whitespace expression and filter input unverified.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for removing the warmed-cache test. The remaining case passed on single-site and multisite. I reproduced two portability issues before landing:
Please use the configured WP_PHP_BINARY the same way the test bootstrap does. With a valid pre-escaped path containing a space, installation succeeds but the test exits 127. Removing the second escape made all five assertions pass. Command construction
Please skip this subprocess test when exec() is unavailable. With WP_TESTS_SKIP_INSTALL=1 and exec disabled, the suite boots and the new test errors. Subprocess call
The coding standards job and local PHPCS both flag the blank line before the final class brace. Removing it clears the finding.
The existing wptexturize() cases already exercise the default whitespace expression. The cold-start case can stay focused on the filter and its cached result.
Skip the test when `exec()` is unavailable and correctly quote the fallback PHP binary.
Remove the assertion for the initial pattern passed to the filter.
The reason will be displayed to describe this comment to others. Learn more.
The portability changes address my previous review. With the same cold-start test and a pre-escaped PHP path containing a space, the prior revision exited 127 and this revision passed. With exec disabled, the prior test errored and this revision skipped. The current head also passed in randomized single-site and multisite runs.
The Copilot note correctly observes that this callback ignores the incoming expression. This test checks whether the cold-start filter runs and whether its return value is cached. The existing wptexturize cases catch loss of default whitespace behavior, so I would keep this case focused on the filter and cache. The Formatting component review is still open.
The reason will be displayed to describe this comment to others. Learn more.
The revised cold-start test addresses my change request. It passed with a PHP binary path containing a space and skipped cleanly with exec disabled. Jonny’s independent Formatting review is still requested.
AI review · gpt-6.2-astra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A new PHPUnit test file is added to check the functionality of the wp_spaces_regexp function in a WordPress application. These tests verify the return value of the function with given input and confirm the filter instantiation calls.
Trac ticket: https://core.trac.wordpress.org/ticket/60319