This guide walks through setting up a local development environment for the ATmosphere WordPress plugin. You'll clone the repo, install dependencies, run a local WordPress instance, and verify the test suite.
- Prerequisites
- Getting Started
- wp-env Configuration
- Docker Management
- Running Tests
- Code Coverage
- Troubleshooting
- Environment Variables
-
Node.js (v18 or later)
node --version
-
npm (ships with Node.js)
npm --version
-
Docker Desktop — backs
wp-env. Must be running before anynpm run env-*command. -
Composer — PHP dependencies, lint, tests, Jetpack Changelogger.
# macOS via Homebrew. brew install composer # Or the official installer. curl -sS https://getcomposer.org/installer | php
-
Git with SSH key setup
ssh -T git@github.com
-
ghCLI — required bynpm run release.gh --version
git clone git@github.com:Automattic/wordpress-atmosphere.git
cd wordpress-atmosphere# JavaScript dependencies.
npm install
# PHP dependencies.
composer installnpm run env-startThis boots WordPress with the ATmosphere plugin installed and activated.
- Frontend: http://localhost:8884
- Admin: http://localhost:8884/wp-admin
- Username:
admin - Password:
password - Tests instance: http://localhost:8885
npm run env-stopwp-env reads .wp-env.json. The defaults shipped with ATmosphere mount the plugin, set ports 8884 / 8885, and force WP_ENVIRONMENT_TYPE=production for the tests instance so production code paths are exercised.
npm run env-start # Start.
npm run env-stop # Stop.
npm run env-test # Run PHPUnit inside wp-env.
npm run env -- <wp-env-args> # Pass through any wp-env subcommand.
# WP-CLI inside the container.
npm run env -- run cli wp plugin list
npm run env -- run cli wp option get atmosphere_settings
npm run env -- run cli wp transient delete --all
npm run env -- run cli wp db cli # MySQL shell.Override in .wp-env.json:
{
"core": "WordPress/WordPress#6.7",
"phpVersion": "8.3"
}# List running containers.
docker ps
# View container logs.
docker logs $(docker ps -q --filter name=wordpress)
# Shell into the WordPress container.
docker exec -it $(docker ps -q --filter name=wordpress) bash
# Resource usage.
docker system df
docker system prune -a # Reclaim space.| Service | Port |
|---|---|
| WordPress | 8884 |
| Tests WordPress | 8885 |
| MySQL | Random external port (see docker ps) |
Override in .wp-env.json if 8884/8885 are in use:
{ "port": 8886, "testsPort": 8887 }npm run env-start
npm run env-test # All tests.
npm run env-test -- --filter=pattern # Tests matching a name pattern.
npm run env-test -- --group=transformer # Tests with @group transformer.
npm run env-test -- tests/phpunit/tests/transformer/class-test-post.phpCommon PHPUnit flags:
--filter=pattern— only tests matching the name regex.--group=name— only tests tagged@group name.--exclude-group=name— skip a group.--stop-on-failure— stop at the first failure.--verbose— more diagnostics.--debug— print test names as they run (useful when a test hangs).
For test-writing patterns (fixtures, the Publisher capture filter, in-flight race simulation), see the test skill.
If you have a local MySQL and the WP_TESTS_* env vars configured, you can run the suite without Docker:
composer test
vendor/bin/phpunit --filter=patternRestart wp-env with Xdebug in coverage mode:
npm run env-start -- --xdebug=coverageThen run tests with a coverage flag:
npm run env-test -- --coverage-text # Terminal summary.
npm run env-test -- --coverage-html ./coverage # Full HTML report.
open coverage/index.html # macOS.phpunit.xml.dist scopes coverage to includes/.
open -a Docker # macOS.
# Wait for the daemon to start, then retry.
npm run env-startThe env-start script passes --auto-port, so wp-env normally picks a free port automatically. If it still fails:
lsof -i :8884
kill -9 <PID>
# Or pick a different port.
npm run env-start -- --port=8886npm run env-stop
npm run env-start
# Still broken? Clear dangling containers and try again.
docker system prune -fnpm run env -- run cli wp plugin activate atmosphere
npm run env -- run cli wp plugin list --status=active- Increase Docker CPU/RAM in Docker Desktop → Settings → Resources.
- Enable VirtioFS in Docker Desktop → Settings → General.
- Exclude
node_modules,vendor,.gitfrom Spotlight / Time Machine watchers.
DEBUG=wp-env:* npm run env-startwp-env understands these:
WP_ENV_HOME— wp-env home directory.WP_ENV_PORT— WordPress port.WP_ENV_TESTS_PORT— tests port.
- PHP Coding Standards — naming, escaping, error handling, performance.
- Class Structure — directory layout and architectural patterns.
- Code Linting — PHPCS rules and how to fix common findings.
- Pull Request Guide — branch naming, checklists, commit format.
- Release Process —
npm run releaseand patch-release workflow.