Skip to content

fix(test): run multisite tests in wp-env and reuse a running test env - #96

Open
Adi-ty wants to merge 1 commit into
mainfrom
fix/test-php-multisite
Open

Adi-ty wants to merge 1 commit into
mainfrom
fix/test-php-multisite

Conversation

@Adi-ty

@Adi-ty Adi-ty commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Description

PHP tests can now run on multisite inside the wp-env test environment, and repeat test runs reuse an environment that is already up.

Technical Details

  • npm run test:php:multisite runs the PHPUnit suite with WP_MULTISITE=1 in the wp-env test environment, which closes the "Multisite tests" known gap. composer test-multisite now uses vendor/bin/phpunit -c phpunit.xml.dist, like composer test.
  • pretest:php skips wp-env start only when wp core is-installed succeeds, so a stopped or still-starting database still gets started. This check moved here from fix(init): unlink example taxonomies when post-types is removed #82, whose cli true check passed with the database down.
  • pretest:php runs composer install when composer.lock is newer than vendor/autoload.php, then touches that file. Composer leaves unchanged autoload files untouched, so without the touch every run after a lockfile change would reinstall.
  • .wp-env.tests.json no longer downloads Twenty Twenty-Two; no test uses a theme.
  • Docs: the multisite command, and a note to restart the environment after editing .wp-env.tests.json, since a running environment is reused as it is.

Checklist

  • npm run test:php from a stopped env starts it and passes (118 tests); a second run reuses it (12 s → 5 s).
  • With only the database container stopped, the next run starts the env and passes.
  • npm run test:php:multisite prints "Running as multisite" and passes, from a stopped and a running env.
  • After touch composer.lock, the next run installs and the run after that skips.
  • composer validate and npm run lint:package-json pass.

@Adi-ty
Adi-ty marked this pull request as ready for review November 19, 2026 12:33
Copilot AI balanced review requested due to automatic review settings November 19, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

This branch has not been deployed

No deployments
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