Skip to content

Add DDEV local development environment#1621

Closed
dd32 wants to merge 11 commits intoWordPress:productionfrom
dd32:add/claude/ddev-setup
Closed

Add DDEV local development environment#1621
dd32 wants to merge 11 commits intoWordPress:productionfrom
dd32:add/claude/ddev-setup

Conversation

@dd32
Copy link
Member

@dd32 dd32 commented Feb 17, 2026

Summary

  • Replace wp-env approach with DDEV for local development, solving the bootstrap ordering issue where wp-env runs wp core install before custom constants are available
  • DDEV gives full control over wp-config.php via disable_settings_management, so all constants are defined before WordPress bootstraps
  • Use dynamic HTTP_HOST detection in sunrise files instead of static SITE_ID_CURRENT_SITE constants, making sunrise work in any environment
  • Update CI to use DDEV for PHP tests across PHP 8.1, 8.4, and 8.5

Key changes

  • .ddev/: DDEV project config (MariaDB 10.11, PHP 8.5, nginx-fpm), multisite nginx rewrites, wp-config template, idempotent setup script
  • Sunrise files: Replace hardcoded SITE_ID_CURRENT_SITE/DOMAIN_CURRENT_SITE with get_domain_network_id using HTTP_HOST
  • 0-aaa-constants.php: Fallback constants mu-plugin for environments where wp-config.php has not defined them yet
  • CI: Replace MySQL service + setup-php with ddev/github-action-setup-ddev
  • Bootstrap: Detect DDEV environment (/var/www/html) for correct paths

Test plan

  • Verify CI passes on all PHP versions (8.1, 8.4, 8.5)
  • ddev start successfully bootstraps WordPress with seed database
  • Sites accessible: central.wordcamp.test, seattle.wordcamp.test/2023/, events.wordpress.test
  • ddev exec phpunit runs tests
  • Sunrise correctly routes requests for all three networks

Generated with Claude Code

dd32 and others added 11 commits February 17, 2026 19:59
Replace static SITE_ID_CURRENT_SITE / DOMAIN_CURRENT_SITE / BLOG_ID_CURRENT_SITE
constants with dynamic HTTP_HOST-based network detection in sunrise.php,
sunrise-events.php, and sunrise-wordcamp.php. This makes sunrise work in any
environment without relying on wp-config.php constants being set first.

Also add 0-aaa-constants.php mu-plugin that provides fallback constant
definitions for environments where wp-config.php hasn't defined them yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DDEV provides full control over wp-config.php via disable_settings_management,
solving the bootstrap ordering issues that prevented wp-env from working.

- config.yaml: MariaDB 10.11, PHP 8.5, nginx-fpm, all .test domains
- nginx/multisite.conf: Subdirectory and Events network rewrite rules
- wp-config-ddev.php: Full wp-config template with all constants pre-defined
- setup.sh: Idempotent post-start hook (WP core, seed DB, test suite)
- web-build/Dockerfile: SVN for Composer packages and WP test suite

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- phpunit-bootstrap.php: Detect DDEV environment for correct paths
- unit-tests.yml: Replace MySQL service + setup-php with DDEV
- .gitignore: Add DDEV generated file patterns
- composer.json: Add test:ddev convenience script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Composer needs setup-php for proper wpackagist authentication and
platform config. DDEV provides the MariaDB database and PHP runtime
for running tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These plugins/themes have been removed from wordpress.org and are no
longer available via wpackagist:
- camptix-payfast-gateway
- supportflow
- tagregator
- p2 theme

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The DDEV db user lacks CREATE DATABASE privileges. Use root/root
(DDEV default) for the install-wp-tests.sh script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The get_redirect_url() function now uses HTTP_HOST instead of a
hardcoded domain. Tests need to set this value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- wp-config-ddev.php: Use __DIR__ instead of dirname(__FILE__)
- 0-aaa-constants.php: Start doc comment with capital letter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dd32 dd32 closed this Feb 17, 2026
@dd32
Copy link
Member Author

dd32 commented Feb 17, 2026

This PR was supposed to go as dd32#3 as a comparison to dd32#2.

Both are an experimentation and not really ready for prime-time yet, I was looking for a more known route to ease LLM Agent testing.

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.

1 participant