Implements automatic creation of required plugin pages (Community Login, Trainer Registration, Trainer Dashboard) upon plugin activation. This addresses E2E test failures caused by missing pages in the test environment. - Adds activation hook in `hvac-community-events.php` to call `hvac_ce_create_required_pages`. - The callback function checks for existing pages by slug and creates them using `wp_insert_post` if missing. Includes debug logging. Also fixes issues identified during E2E test debugging: - Corrects fatal error in `includes/community/class-login-handler.php` by replacing undefined constant `HVAC_COMMUNITY_EVENTS_PATH` with `HVAC_CE_PLUGIN_DIR`. - Updates `tests/e2e/tests/login.spec.ts` to use the correct selector `#wp-submit` for the login form submit button instead of `button[type="submit"]`. Documentation updates: - Adds `docs/automatic-page-creation-plan.md`. - Updates `README.md` regarding automatic page creation. - Updates Memory Bank files (`decisionLog.md`, `progress.md`, `activeContext.md`). Note: Activation hook logging did not appear during WP-CLI activation, requiring further investigation if page creation issues persist. E2E test confirmation pending.
167 lines
No EOL
4.2 KiB
Markdown
167 lines
No EOL
4.2 KiB
Markdown
# System Patterns
|
|
|
|
This file documents the architectural and design patterns used in the project.
|
|
2025-03-26 11:13:00 - Updated with development environment workflow patterns
|
|
|
|
## Development Environment Patterns
|
|
|
|
### Container Architecture
|
|
* **Docker Composition**
|
|
* WordPress (PHP-FPM)
|
|
* Nginx web server
|
|
* MariaDB database
|
|
* phpMyAdmin utility
|
|
* Shared volumes for persistence
|
|
* Network isolation
|
|
* Environment-based configuration
|
|
|
|
### Development Workflow Patterns
|
|
* **Backup-Based Setup**
|
|
* Production data backup creation
|
|
* Local backup storage
|
|
* Backup-based environment initialization
|
|
* Consistent development environments
|
|
* Offline development capability
|
|
* **Script Organization**
|
|
* Standardized naming conventions
|
|
* Clear separation of concerns
|
|
* Comprehensive error handling
|
|
* User-friendly feedback
|
|
* Modular script design
|
|
|
|
### Configuration Management
|
|
* **Environment Variables**
|
|
* Database credentials
|
|
* WordPress settings
|
|
* Development flags
|
|
* Debug options
|
|
* Site URLs
|
|
* **Docker Volumes**
|
|
* WordPress files
|
|
* Database data
|
|
* Configuration files
|
|
* SSL certificates
|
|
* Logs
|
|
|
|
### WordPress Integration
|
|
* **Core Configuration**
|
|
* wp-config.php management
|
|
* Environment-based settings
|
|
* Debug mode control
|
|
* URL configuration
|
|
* Security settings
|
|
* **Plugin Management**
|
|
* Controlled activation
|
|
* Version management
|
|
* Dependency handling
|
|
* Update procedures
|
|
* Compatibility checks
|
|
|
|
### Database Patterns
|
|
* **Connection Management**
|
|
* Environment-based credentials
|
|
* Connection pooling
|
|
* Error handling
|
|
* Retry mechanisms
|
|
* Timeout configuration
|
|
* **Data Access**
|
|
* WordPress WPDB wrapper
|
|
* Prepared statements
|
|
* Transaction support
|
|
* Query optimization
|
|
* Cache integration
|
|
|
|
### Security Patterns
|
|
* **Development Security**
|
|
* Disabled SSL requirement
|
|
* Debug mode enabled
|
|
* Error display active
|
|
* Test data isolation
|
|
* Local-only access
|
|
* **Production Preparation**
|
|
* SSL configuration ready
|
|
* Error logging configured
|
|
* Security headers prepared
|
|
* Access controls defined
|
|
* Data sanitization
|
|
|
|
### Testing Architecture
|
|
* **Test Environment**
|
|
* Isolated containers
|
|
* Test-specific configuration
|
|
* Data fixtures
|
|
* Mock services
|
|
* Debug capabilities
|
|
* **Test Types**
|
|
* Unit tests
|
|
* Integration tests
|
|
* E2E tests
|
|
* Performance tests
|
|
* Security tests
|
|
|
|
### Logging and Monitoring
|
|
* **Log Management**
|
|
* PHP error logs
|
|
* WordPress debug log
|
|
* Nginx access/error logs
|
|
* Database logs
|
|
* Container logs
|
|
* **Monitoring**
|
|
* Container health checks
|
|
* Resource usage
|
|
* Error tracking
|
|
* Performance metrics
|
|
* Security events
|
|
|
|
### Version Control
|
|
* **Feature Branches**
|
|
* Feature branches
|
|
* Pull requests
|
|
* Code review process
|
|
* Continuous integration
|
|
* Automated testing
|
|
|
|
2025-03-27 13:55:00 - Added WordPress Unit Testing Patterns
|
|
|
|
### Unit Testing Architecture
|
|
* **Containerized Testing**
|
|
* WordPress test environment inside Docker container
|
|
* WordPress testing libraries installed in container
|
|
* Database access from container
|
|
* Shared file system via volume mounts
|
|
* Consistent environment across developers
|
|
|
|
* **Test Configuration**
|
|
* PHPUnit configuration in phpunit.xml.dist
|
|
* Bootstrap configuration in tests/bootstrap.php
|
|
* WordPress test framework in /tmp/wordpress-tests-lib
|
|
* Test database isolated from development database
|
|
* Environment variables for configuration
|
|
|
|
* **Test Patterns**
|
|
* WP_UnitTestCase base class for WordPress-aware tests
|
|
* Fixtures and factories for test data
|
|
* Test suite organization by feature
|
|
* Isolated test methods
|
|
* Consistent validation patterns
|
|
|
|
|
|
2025-03-28 05:33:00 - Updated Test Configuration Patterns
|
|
|
|
### Test Configuration Patterns
|
|
* **Environment-Specific Settings**
|
|
* Docker-aware database configuration
|
|
* Container-specific file paths
|
|
* Environment variable integration
|
|
* Separate test database
|
|
* Isolated test framework files
|
|
|
|
* **Framework Organization**
|
|
* WordPress test framework in vendor directory
|
|
* Composer-managed dependencies
|
|
* Standardized configuration locations
|
|
* Clear separation between test and development databases
|
|
* Environment-aware path resolution
|
|
|
|
|
|
2025-03-26 11:13:00 - Added development environment workflow patterns |