Professional Docker-based WordPress testing environment for plugin development, quality assurance, automated testing workflows, and AI agent integration.
# Clone the repository
git clone https://github.com/typelicious/wp-testing-env.git
cd wp-testing-env
# Copy environment configuration
cp .env.example .env
# Start the environment
docker-compose up -d
# Run WordPress setup
./scripts/setup-wordpress-fixed.shAccess Services:
- π WordPress: http://localhost:8082
- ποΈ phpMyAdmin: http://localhost:8083
- π§ MailHog: http://localhost:8025
- π§ WP-CLI:
docker-compose exec wp-cli wp <command>
- WordPress 6.5+ with full debugging enabled
- MySQL 8.0 with health checks and persistence
- phpMyAdmin for database management
- MailHog for email testing and debugging
- WP-CLI for command-line management
- Full error reporting and logging
- Query monitoring (with Query Monitor)
- Debug Bar integration
- Custom PHP configuration
- Development mode enabled
- Volume mounts for easy plugin installation
- Automated plugin installation scripts
- Standard and pro plugin support
- REST API testing endpoints
- Isolated testing environment
- Hot-reload for plugins and themes
- Multiple WordPress instances support
- Customizable environment variables
- Production/Staging/Development modes
- Automated backup and restore
- Agent-native design - Optimized for AI agent interaction and automation
- REST API-first architecture - Complete WordPress API coverage for agent access
- Structured test outputs - Machine-readable test results and health checks
- Automated workflow support - Compatible with SkillWeave and faigate AI orchestration
- Production validation - Agent-verifiable deployment readiness checks
wp-testing-env/
βββ docker-compose.yml # Docker Compose configuration
βββ .env # Environment variables (gitignored)
βββ .env.example # Environment template
βββ README.md # This file
β
βββ scripts/ # Utility scripts
β βββ setup-wordpress-fixed.sh # WordPress installation
β βββ install-plugin.sh # Plugin installer
β βββ init-test-environment.sh # Environment initialization
β
βββ plugins/ # WordPress plugins
β βββ README.md # Plugin guidelines
β βββ *.zip # Plugin archives (gitignored)
β
βββ themes/ # WordPress themes
βββ uploads/ # Media uploads
βββ logs/ # Application logs
βββ reports/ # Test reports
# WordPress Configuration
WORDPRESS_PORT=8082
WORDPRESS_DEBUG=1
WORDPRESS_ADMIN_USER=admin
WORDPRESS_ADMIN_PASSWORD=admin
# Database Configuration
MYSQL_ROOT_PASSWORD=secure_password
MYSQL_DATABASE=wordpress_test
MYSQL_USER=wordpress
MYSQL_PASSWORD=wordpress_password
# Service Ports
PHPMYADMIN_PORT=8083
MAILHOG_SMTP_PORT=1025
MAILHOG_WEB_PORT=8025Create config/php.ini for custom PHP settings:
memory_limit = 256M
max_execution_time = 300
upload_max_filesize = 64M
post_max_size = 64M# Install a plugin from ZIP file
./scripts/install-plugin.sh plugins/query-monitor.zip
# Install multiple plugins
./scripts/install-plugin.sh plugins/plugin1.zip plugins/plugin2.zip# List installed plugins
docker-compose exec wp-cli wp plugin list
# Activate a plugin
docker-compose exec wp-cli wp plugin activate elementor
# Create test content
docker-compose exec wp-cli wp post create \
--post_title="Test Post" \
--post_content="Test content" \
--post_status=publish-
Setup Environment:
./scripts/init-test-environment.sh
-
Install Test Plugin:
./scripts/install-plugin.sh path/to/plugin.zip
-
Run Automated Tests:
# Custom test scripts ./tests/activation-test.sh ./tests/rest-api-test.sh -
Generate Reports:
# Reports saved to ./reports/
- β Activation hooks
- β Database table creation
- β Default settings initialization
- β Compatibility checks
- β Endpoint registration
- β Authentication/Authorization
- β Data validation
- β Error handling
- β Database query optimization
- β Memory usage monitoring
- β Load time analysis
- β Caching effectiveness
- β WordPress version compatibility
- β PHP version compatibility
- β Plugin conflicts
- β Theme compatibility
.envfile gitignored by default- Unique passwords for each environment
- Database root password protection
- Read-only volumes where possible
- Development mode enabled
- Debug information protected
- Secure database prefixes
- Limited external access
- Non-root user execution
- Resource limits
- Network isolation
- Regular image updates
We welcome contributions! Please see our Contributing Guidelines for details.
# Fork and clone
git clone https://github.com/typelicious/wp-testing-env.git
# Create feature branch
git checkout -b feature/awesome-feature
# Make changes and test
docker-compose up -d
./scripts/test-all.sh
# Commit and push
git commit -m "Add awesome feature"
git push origin feature/awesome-feature
# Create Pull Request- Follow WordPress coding standards
- Use meaningful commit messages
- Include tests for new features
- Update documentation
| Test Scenario | Average Time | Memory Usage | Notes |
|---|---|---|---|
| Fresh Install | 45s | 128MB | Includes WordPress setup |
| Plugin Activation | 2-5s | Varies | Depends on plugin complexity |
| REST API Request | < 100ms | Minimal | Local network conditions |
| Database Query | < 50ms | Low | Optimized MySQL configuration |
This environment includes a comprehensive testing framework for WordPress plugins with REST API endpoints. The framework provides tools for testing plugin installation, activation, API endpoints, and authentication.
The environment includes example test scripts that demonstrate how to test WordPress plugin REST APIs. To run the example tests:
# Run WordPress health check (verifies environment is running)
./tests/test-wordpress-health.sh
# Run plugin activation test (requires a plugin zip file)
./tests/test-plugin-activation.sh plugins/your-plugin.zip
# Review example test scripts for implementation patterns:
# - tests/test-plugin-api.sh.example - Complete API test template
# - tests/test-helpers.sh - Shared test utilitiesMany plugins require authentication via API keys or tokens. The testing framework includes utilities for managing authentication:
# Example: Setting up API key authentication
echo "YOURPLUGIN_API_KEY=your_api_key_here" >> .env
# Example test script for API key validation is available at:
# scripts/setup-api-key.sh.exampleThe testing framework supports comprehensive test coverage:
- Basic API Connectivity: Verify plugin namespace and activation
- Authentication: Test API key validation and security
- CRUD Operations: Test create, read, update, delete operations
- Error Handling: Test error responses and edge cases
- Performance: Test response times under load
- Integration: Test integration with WordPress core and other plugins
A successful test suite validates that your plugin is ready for production deployment. Test completion indicates:
- β Plugin correctly installed and activated
- β REST API endpoints properly registered
- β Authentication system functional (if applicable)
- β Core functionality operational
- β Error handling properly implemented
- β Ready for production use
This environment includes comprehensive testing support for the Elementify WordPress automation toolkit. Elementify provides over 70 REST API endpoints for WordPress automation, and this testing environment includes specialized tools for API key authentication and endpoint validation.
# 1. Start the environment
docker-compose up -d
# 2. Install and activate Elementify plugin
./scripts/install-plugin.sh plugins/elementify.zip
# 3. Generate API key with correct capabilities
docker-compose exec wp-cli wp eval-file scripts/generate-api-key.php
# 4. Run comprehensive Elementify API tests
./tests/test-elementify-comprehensive.shElementify requires API key authentication via the X-Elementify-Key header. The testing environment includes scripts to generate correctly structured API keys:
Elementify expects API keys with this specific structure:
[
'is_active' => true, // NOT 'enabled'
'label' => 'Test Key', // NOT 'name'
'capabilities' => [...], // Explicit list of 46 capabilities (not "*")
'created_at' => '2025-04-20T10:30:00Z' // ISO 8601 format
]Using WP-CLI (Recommended):
# Generate API key with all capabilities
docker-compose exec wp-cli wp eval-file scripts/generate-api-key.php
# Alternative: Generate using improved script
docker-compose exec wp-cli wp eval-file scripts/generate-api-key-v2.phpManual API Key Setup:
# Check generated API key
docker-compose exec wp-cli wp option get elementify_mcp_api_keys --format=json
# Export API key as environment variable
export ELEMENTIFY_API_KEY=$(docker-compose exec wp-cli wp option get elementify_mcp_api_keys --format=json | jq -r '.[0].key')
echo "ELEMENTIFY_API_KEY=$ELEMENTIFY_API_KEY" >> .envThe testing environment includes multiple test scripts for Elementify:
| Script | Purpose | Coverage |
|---|---|---|
test-elementify-comprehensive.sh |
Complete test suite | 70+ endpoints, detailed statistics, bug detection |
test-elementify-api-improved.sh |
Improved authentication | Focus on API key validation and error handling |
test-elementify-api.sh |
Basic API tests | Core functionality and endpoint discovery |
# Run comprehensive tests (recommended)
./tests/test-elementify-comprehensive.sh
# Run with specific API key
ELEMENTIFY_API_KEY="your_key_here" ./tests/test-elementify-comprehensive.sh
# Run in CI mode (non-interactive)
CI=true ./tests/test-elementify-comprehensive.shElementify defines 46 capabilities for fine-grained access control. The testing environment handles capabilities correctly:
# View all Elementify capabilities
docker-compose exec wp-cli wp eval "print_r(Elementify\MCP\Auth\Capabilities::all());"
# Check configured capabilities
docker-compose exec wp-cli wp option get elementify_mcp_governance --format=jsonImportant: Elementify does NOT accept wildcard ("*") capabilities. All 46 capabilities must be explicitly listed in both API keys and governance settings.
The enhanced CI workflow (ci-enhanced.yml) automatically:
- Generates API Keys - Creates correctly structured Elementify API keys
- Runs Comprehensive Tests - Executes all Elementify test scripts
- Reports Results - Provides detailed test statistics and coverage reports
- Detects Plugin Bugs - Automatically skips known buggy endpoints (e.g., AddonRegistry errors)
# Example workflow step
- name: Test Elementify API
run: |
export ELEMENTIFY_API_KEY=$(scripts/generate-ci-key.sh)
./tests/test-elementify-comprehensive.shSome Elementify endpoints may return 500 errors due to plugin bugs:
- AddonRegistry Abstract Class Error - Endpoints
/elementify/v1/addonsand/elementify/v1/site/assessmentmay fail - Workaround: Test scripts automatically detect and skip these endpoints
- Fix: Update Elementify plugin to resolve abstract class implementation
- 401 Unauthorized: Verify API key structure matches exact format requirements
- 403 Forbidden: Check capabilities list includes all 46 capabilities (not wildcard)
- Missing Headers: Ensure
X-Elementify-Keyheader is sent with requests
The comprehensive test suite validates:
| Category | Endpoints Tested | Key Features |
|---|---|---|
| Templates | 15+ endpoints | CRUD operations, versioning, search |
| Site Management | 10+ endpoints | Assessment, settings, recommendations |
| Global Styles | 5+ endpoints | Colors, typography, design tokens |
| Pages & Content | 20+ endpoints | Composition, workflow, approval |
| Addons & Ecosystem | 10+ endpoints | Detection, configuration, optimization |
| Media & Assets | 5+ endpoints | Upload, management, optimization |
| WooCommerce | 5+ endpoints | Products, orders, categories |
# Test only template endpoints
./tests/test-elementify-comprehensive.sh --category templates
# Test with verbose output
./tests/test-elementify-comprehensive.sh --verbose
# Generate JSON test report
./tests/test-elementify-comprehensive.sh --json-reportCreate tests/elementify-test-config.json:
{
"api_base": "http://localhost:8082/wp-json/elementify/v1",
"api_key": "${ELEMENTIFY_API_KEY}",
"skip_endpoints": ["/addons", "/site/assessment"],
"timeout": 30,
"retry_attempts": 3
}API Key Not Working:
# Verify key structure
docker-compose exec wp-cli wp option get elementify_mcp_api_keys --format=json | jq .
# Regenerate key
docker-compose exec wp-cli wp option delete elementify_mcp_api_keys
docker-compose exec wp-cli wp eval-file scripts/generate-api-key.phpEndpoints Returning 500 Errors:
# Check WordPress error log
docker-compose logs wordpress --tail 50
# Disable problematic endpoints in tests
export SKIP_BUGGY_ENDPOINTS=true
./tests/test-elementify-comprehensive.shCapability Errors:
# Reset governance settings
docker-compose exec wp-cli wp option update elementify_mcp_governance '{"capabilities": ["templates:read", "...all 46 capabilities..."]}'
# Verify capabilities
docker-compose exec wp-cli wp eval "echo json_encode(Elementify\MCP\Auth\Capabilities::all());"Test scripts generate detailed reports:
# View test statistics
cat reports/elementify-test-*.json | jq '.statistics'
# Check endpoint coverage
cat reports/elementify-test-*.json | jq '.coverage'
# Identify failing endpoints
cat reports/elementify-test-*.json | jq '.failures[]'Reports include:
- β Passed tests with response times
- β Failed tests with error details
β οΈ Skipped tests (buggy endpoints)- π Statistics (success rate, average response time)
- π― Coverage (percentage of endpoints tested)
API Authentication Errors:
# Check if your plugin's API keys are configured
docker exec wptesting-wordpress wp option get yourplugin_api_keys --allow-root
# Reset plugin activation
docker exec wptesting-wordpress wp plugin deactivate your-plugin --allow-root
docker exec wptesting-wordpress wp plugin activate your-plugin --allow-rootREST Endpoint 404 Errors:
# Verify REST API is working
curl http://localhost:8082/wp-json/
# Check your plugin's namespace
curl http://localhost:8082/wp-json/yourplugin/v1Plugin Activation Issues:
# Check plugin status
docker exec wptesting-wordpress wp plugin status your-plugin --allow-root
# Review error logs
docker logs wptesting-wordpress --tail 50Port Conflicts:
# Check used ports
lsof -i :8082
# Update .env with different ports
WORDPRESS_PORT=8083
PHPMYADMIN_PORT=8084Permission Errors:
# Reset Docker permissions
docker-compose down -v
sudo chown -R $USER:$USER .
docker-compose up -dDatabase Issues:
# Check MySQL health
docker-compose exec mysql mysqladmin ping
# Reset database
docker-compose down -v
docker-compose up -dView application logs:
# WordPress logs
docker-compose logs wordpress
# MySQL logs
docker-compose logs mysql
# All services
docker-compose logs -fCheck WordPress debug log:
docker-compose exec wordpress tail -f /var/www/html/wp-content/debug.logKeep your testing environment up-to-date with the built-in update system.
The update system is configured via config/update-config.yaml:
# Example configuration
updates:
enabled: true
check_interval_hours: 24
components:
wordpress:
enabled: true
track: "latest"
auto_update: false
docker_images:
enabled: true
auto_pull: false# Check for updates (dry run)
./scripts/update-environment.sh --dry-run
# Apply updates
./scripts/update-environment.sh
# Force update (ignore check interval)
./scripts/update-environment.sh --force
# Verbose output
./scripts/update-environment.sh --verbose- Smart Update Checks: Only updates when needed based on configurable intervals
- Component Selection: Choose which components to update (WordPress, Docker images, plugins, themes)
- Safety First: Automatic backups before updates, rollback on failure
- Post-Update Testing: Verify environment health after updates
- Configurable Policies: Control backup retention, notifications, and update behavior
The update script requires yq for YAML processing:
# macOS
brew install yq
# Linux
sudo snap install yq
# Alternative: Install from GitHub
# See: https://github.com/mikefarah/yqFor automated updates, add to crontab:
# Daily update check at 2 AM
0 2 * * * cd /path/to/wp-testing-env && ./scripts/update-environment.sh >> logs/updates.log 2>&1
# Weekly forced update on Sundays at 3 AM
0 3 * * 0 cd /path/to/wp-testing-env && ./scripts/update-environment.sh --force >> logs/updates.log 2>&1- SkillWeave - AI-powered development workflow automation
- faigate - FusionAIze Gateway for AI model orchestration
- Elementify - WordPress automation toolkit
This project is licensed under the MIT License - see the LICENSE file for details.
- WordPress community for excellent documentation
- Docker team for containerization technology
- All contributors who help improve this project
- π Documentation: GitHub Wiki
- π Issues: GitHub Issues
- π¬ Discussion: GitHub Discussions
- π Features: GitHub Projects
Maintained by typelicious β’ Part of the FusionAIze ecosystem