| name | dev |
| description | Development workflows for WordPress ActivityPub plugin including wp-env setup, testing commands, linting, and build processes. Use when setting up development environment, running tests, checking code quality, building assets, or working with wp-env. |
ActivityPub Development Cycle
Quick reference for common development workflows in the WordPress ActivityPub plugin.
Quick Reference
Environment Management
npm run env-start
npm run env-stop
Testing Commands
npm run env-test
npm run env-test -- --filter=pattern
npm run env-test -- path/to/test.php
npm run env-test -- --group=name
npm run test:e2e
npm run test:e2e:debug
Code Quality
composer lint
composer lint:fix
npm run lint:js
npm run lint:css
npm run format
Building Assets
npm run build
npm run dev
Code Coverage
npm run env-start -- --xdebug=coverage
npm run env-test -- --coverage-text
npm run env-test -- --coverage-html ./coverage
Comprehensive Documentation
See docs/development-environment.md for detailed setup instructions.
See tests/README.md for comprehensive testing guidance.
See docs/code-linting.md for linting configuration and standards.
Pre-commit Hooks
The repository uses automated pre-commit hooks (.githooks/pre-commit) that run automatically on git commit:
- Sort PHP imports - Automatically organizes use statements.
- Check unused imports - Prevents unused use statements.
- Validate test patterns - Blocks
remove_all_filters('pre_http_request').
- Run PHPCS auto-fix - Applies coding standards automatically.
- Format JavaScript - Runs wp-scripts formatter.
IMPORTANT: Hooks modify staged files automatically. Always review changes before committing. If hooks make changes, you'll need to stage them and commit again.
Setup: Hooks are installed by npm run prepare (runs automatically after npm install).
Common Development Workflows
Initial Setup
git clone git@github.com:Automattic/wordpress-activitypub.git
cd wordpress-activitypub
npm install
composer install
npm run env-start
Making Changes Workflow
npm run env-test -- --filter=FeatureName
composer lint
npm run lint:js
git add .
git commit -m "Description"
Before Creating PR
npm run env-test
npm run build
composer lint
npm run lint:js
Debugging Failing Tests
npm run env-test -- --verbose --filter=test_name
npm run env-test -- tests/phpunit/tests/path/to/test.php
npm run env-test -- --list-groups
npm run env-test -- --group=specific_group
Fresh Environment
npm run env-stop
npm run env-start
Key Files
package.json - npm scripts and dependencies.
composer.json - PHP dependencies and lint scripts.
.wp-env.json - wp-env configuration.
phpcs.xml - PHP coding standards (custom WordPress rules).
.githooks/pre-commit - Pre-commit automation.