Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .wp-env.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"plugins": [
"."
],
"themes": [
"https://downloads.wordpress.org/theme/twentytwentytwo.zip"
],
"testsEnvironment": false,
"config": {
"WP_DEBUG": true
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"lint": "phpcs",
"phpstan": "phpstan analyse --memory-limit=1G",
"test": "vendor/bin/phpunit -c phpunit.xml.dist",
"test-multisite": "WP_MULTISITE=1 phpunit --exclude-group=ms-excluded",
"test-multisite": "WP_MULTISITE=1 vendor/bin/phpunit -c phpunit.xml.dist --exclude-group=ms-excluded",
"pot": "wp i18n make-pot . ./languages/project-name-features.pot --domain=project-name-features --include=\"inc,templates,assets/build/blocks\""
}
}
1 change: 0 additions & 1 deletion docs/internal/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,3 @@ Keep implementation follow-ups out of documentation pull requests; record each w
- **Stale wording:** `.npmrc` still calls `wp-tooling` a private repository, and `bin/init.js` suggests the pilot `npm install --install-links`.
- **Lockfile URLs:** `package-lock.json` resolves `@rtcamp/*` over `git+ssh://`. Confirm a clean `npm ci` works for a developer without a GitHub SSH key.
- **Downstream docs workflow:** `documentation.yml` ships into client projects. It is inert there (its jobs only run in `rtCamp/plugin-elementary`), but decide whether init cleanup should remove it.
- **Multisite tests:** `composer test-multisite` has no `wp-env` wrapper.
3 changes: 2 additions & 1 deletion docs/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Run the focused test first, then the full set before opening a pull request.
# PHP tests — run inside the wp-env test environment (started on demand).
npm run test:php -- --filter ShortcodesTest # one test class
npm run test:php # the whole suite
npm run test:php:multisite # the whole suite on multisite

# PHP style and static analysis — run on the host (PHP 8.2+).
composer lint # PHPCS (rtCampWP ruleset)
Expand All @@ -67,7 +68,7 @@ npm run lint:css
npm run lint:package-json
```

`npm run test:php` needs `npm run wp-env start` first; its `pretest` step runs `composer install` inside the container when `vendor/` is missing. `composer test` expects a WordPress test library on the host and is not the supported route.
`npm run test:php` starts the test environment unless it is already up with its database ready, and runs `composer install` inside it when `composer.lock` is newer than `vendor/`. A running environment is reused as it is, so restart it with `npm run wp-env start -- --config=.wp-env.tests.json` after editing `.wp-env.tests.json`. `npm run test:php:multisite` runs the same suite with `WP_MULTISITE=1`. `composer test` and `composer test-multisite` expect a WordPress test library on the host and are not the supported route.

**Coverage:** start the environment with Xdebug, then run the coverage script. The HTML report is written to `coverage/`.

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@
"test": "npm-run-all --parallel test:js test:php",
"test:js": "wp-scripts test-unit-jest --config=tests/js/jest.config.js --passWithNoTests",
"test:js:watch": "npm run test:js -- --watch",
"pretest:php": "wp-env start --config=.wp-env.tests.json && wp-env run --config=.wp-env.tests.json cli --env-cwd=wp-content/plugins/$(basename \"$PWD\") -- sh -c 'test -f vendor/autoload.php || composer install --no-interaction'",
"pretest:php": "(wp-env run --config=.wp-env.tests.json cli wp core is-installed >/dev/null 2>&1 || wp-env start --config=.wp-env.tests.json) && ([ vendor/autoload.php -nt composer.lock ] || wp-env run --config=.wp-env.tests.json cli --env-cwd=wp-content/plugins/$(basename \"$PWD\") -- sh -c 'composer install --no-interaction && touch vendor/autoload.php')",
"test:php": "wp-env run --config=.wp-env.tests.json cli --env-cwd=wp-content/plugins/$(basename \"$PWD\") -- vendor/bin/phpunit -c phpunit.xml.dist",
"pretest:php:multisite": "npm run pretest:php",
"test:php:multisite": "wp-env run --config=.wp-env.tests.json cli --env-cwd=wp-content/plugins/$(basename \"$PWD\") -- env WP_MULTISITE=1 vendor/bin/phpunit -c phpunit.xml.dist --exclude-group=ms-excluded",
"pretest:php:coverage": "echo \"\\e[1m\\e[32mMake sure you have run npm run wp-env start -- --config=.wp-env.tests.json --xdebug=coverage before using this command\\e[0m\" && wp-env run --config=.wp-env.tests.json cli --env-cwd=wp-content/plugins/$(basename \"$PWD\") -- sh -c 'test -f vendor/autoload.php || composer install --no-interaction'",
"test:php:coverage": "wp-env run --config=.wp-env.tests.json cli --env-cwd=wp-content/plugins/$(basename \"$PWD\") -- vendor/bin/phpunit -c phpunit.xml.dist --coverage-html coverage",
"posttest:php:coverage": "echo \"\\e[1m\\e[32mIf you have run this command with xdbug coverage enabled, you can view the coverage report at /coverage path\\e[0m\"",
Expand Down
Loading