Conversation
YvesCesar
marked this pull request as draft
September 14, 2026 22:05
YvesCesar
marked this pull request as ready for review
September 14, 2026 22:16
vitormattos
requested changes
Sep 15, 2026
vitormattos
left a comment
Member
There was a problem hiding this comment.
The test suite is going in a good direction.
I like the separation between Unit and Integration, the use of the real WordPress REST server in integration tests, and blocking unexpected external HTTP requests.
I left some comments before merging:
- one workflow file per tool;
- make Unit tests really independent from the WordPress bootstrap and database;
- declare only the WordPress versions we are really testing and supporting;
- when we find a known bug, add a regression test for the correct behavior and fix the bug instead of adding a green characterization test for the wrong behavior.
After these changes I think the test foundation will be much clearer and safer to extend.
This was referenced Sep 15, 2026
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
YvesCesar
force-pushed
the
test/integration-harness
branch
from
September 16, 2026 23:02
b01079f to
29699fc
Compare
vitormattos
requested changes
Sep 17, 2026
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The plugin had no tests. This adds the PHPUnit harness and a characterization suite over the current behaviour, on top of the static analysis setup from #9 (hence the base branch; it retargets to
mainonce #9 is merged).Harness
composer testis all it takes.composer installpulls WordPress itself (roots/wordpress, installed intovendor/wordpress) and the core test suite (wp-phpunit), so the only external requirement is a MySQL/MariaDB server with a database the suite may wipe.tests/wp-tests-config.phpreads everything from the environment (WP_TESTS_DB_*,WP_CORE_DIR), defaulting to the local stack.tests/bootstrap.phpanswers any unexpected HTTP request with aWP_Error, and tests that exercise an outgoing call answer it throughtests/Support/FakeHttp.php, which uses WordPress' ownpre_http_requestfilter instead of a mock object.tests.ymlruns PHPUnit on PHP 8.1 and 8.3 against a MariaDB service, andcode-quality.ymlkeeps one job per check —lint,coding-standardsandstatic-analysis— so a failure names the tool that failed. TheciComposer script still chains all four locally.tests/as well, withphpstan/phpstan-phpunit— among other things it validates the@dataProviderreferences. TheignoreErrorsentry for the salts is gone, sincetests/wp-tests-config.phpdefines them.Tests
143 tests.
tests/mirrors the plugin file by file withTest.phpappended: a file goes toUnit/when it only feeds values to a function and reads the returned value, and toIntegration/when it goes through WordPress — options, hooks, the REST server or the database.Two current behaviours are locked in as they are, each with the reason in the test docblock:
update_option()sanitizes the value and, when the option does not exist yet, hands it toadd_option(), which sanitizes it again. The deploy token and the webhook secret are therefore encrypted twice on the first save and only work from the second one on.libresign_trigger_github_action_on_publish(),&&binds tighter than||, so publishing any post type dispatches a site deploy; the post type is only considered when published content leaves the publish status.WooCommerce is not installed in the suite, so what only exists with it loaded — the root account endpoints, the invoice title, the addresses redirect and the subscription change confirmation — is still uncovered.
Verification
composer ciis green: lint, PHPCS, PHPStan level 5 includingtests/, and 143 tests passing.