- Added HVAC_Role_Manager class with role/permission management - Implemented test cases in HVAC_Role_Manager_Test.php - Created API documentation in docs/role-manager-api.md - Updated testing improvement plan with progress - Added design decisions to memory-bank/decisionLog.md Includes: - Role creation/deletion methods - Permission management system - Role conflict detection - Permission inheritance logic - Comprehensive test coverage
		
			
				
	
	
	
	
		
			2.8 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			2.8 KiB
		
	
	
	
	
	
	
	
PHPUnit Staging Environment Setup Guide
Overview
This guide documents the PHPUnit configuration in the staging environment, including installation, execution, and troubleshooting steps.
Installation
- PHPUnit is installed via Composer:
composer require --dev phpunit/phpunit:^9.6
- Required dependencies are already configured in composer.json:
{
    "require-dev": {
        "phpunit/phpunit": "^9.6",
        "yoast/phpunit-polyfills": "^1.0",
        "wp-phpunit/wp-phpunit": "^6.7",
        "yoast/wp-test-utils": "^1.0"
    },
    "autoload-dev": {
        "psr-4": {
            "HVAC\\Tests\\": "tests/"
        }
    }
}
Test Execution
The test execution scripts now support two methods of running PHPUnit:
- Using global PHPUnit installation:
phpunit --bootstrap tests/bootstrap-staging.php --testsuite unit
- Using vendor PHPUnit (fallback):
./vendor/bin/phpunit --bootstrap tests/bootstrap-staging.php --testsuite unit
The system automatically detects which method to use, with vendor path as fallback.
Environment Configuration
- The WP_PHPUNIT__DIR environment variable is set to:
export WP_PHPUNIT__DIR=$PLUGIN_PATH/vendor/wp-phpunit/wp-phpunit
- Test results are stored in:
$PLUGIN_PATH/test-results/
Troubleshooting
Common Issues
- 
"Command not found" error: - Verify Composer installation
- Check vendor/bin directory exists
- Ensure correct PATH configuration
 
- 
Autoloader issues: - Verify composer.json autoload-dev configuration
- Run composer dump-autoload
- Check namespace matches test files
 
- 
Bootstrap file not found: - Verify bootstrap-staging.php exists in tests directory
- Check file permissions
- Ensure correct path in test execution command
 
Verification Steps
- Check PHPUnit installation:
phpunit --version
# or
./vendor/bin/phpunit --version
- Verify autoloader:
composer dump-autoload -v
- Test configuration:
phpunit --bootstrap tests/bootstrap-staging.php --testsuite unit --verbose
Support
For additional support or to report issues, please:
- Check the test output logs in test-output.log
- Review error messages in the staging environment logs
Recent Updates
April 12, 2025
- Added vendor path fallback mechanism
- Updated documentation across all guides
- Verified configuration in staging environment
- Added troubleshooting section for common issues
Integration Notes
- PHPUnit configuration is now synchronized across all environments
- Test execution scripts automatically detect and use appropriate PHPUnit installation
- All paths are relative to ensure consistency between environments
- Documentation updated in README.md and MIGRATION_GUIDE.md
- Contact the development team with specific error details