upskill-event-manager/test-find-trainer-direct.php
Ben c3e7fe9140 feat: comprehensive HVAC plugin development framework and modernization
## Major Enhancements

### 🏗️ Architecture & Infrastructure
- Implement comprehensive Docker testing infrastructure with hermetic environment
- Add Forgejo Actions CI/CD pipeline for automated deployments
- Create Page Object Model (POM) testing architecture reducing test duplication by 90%
- Establish security-first development patterns with input validation and output escaping

### 🧪 Testing Framework Modernization
- Migrate 146+ tests from 80 duplicate files to centralized architecture
- Add comprehensive E2E test suites for all user roles and workflows
- Implement WordPress error detection with automatic site health monitoring
- Create robust browser lifecycle management with proper cleanup

### 📚 Documentation & Guides
- Add comprehensive development best practices guide
- Create detailed administrator setup documentation
- Establish user guides for trainers and master trainers
- Document security incident reports and migration guides

### 🔧 Core Plugin Features
- Enhance trainer profile management with certification system
- Improve find trainer functionality with advanced filtering
- Strengthen master trainer area with content management
- Add comprehensive venue and organizer management

### 🛡️ Security & Reliability
- Implement security-first patterns throughout codebase
- Add comprehensive input validation and output escaping
- Create secure credential management system
- Establish proper WordPress role-based access control

### 🎯 WordPress Integration
- Strengthen singleton pattern implementation across all classes
- Enhance template hierarchy with proper WordPress integration
- Improve page manager with hierarchical URL structure
- Add comprehensive shortcode and menu system

### 🔍 Developer Experience
- Add extensive debugging and troubleshooting tools
- Create comprehensive test data seeding scripts
- Implement proper error handling and logging
- Establish consistent code patterns and standards

### 📊 Performance & Optimization
- Optimize database queries and caching strategies
- Improve asset loading and script management
- Enhance template rendering performance
- Streamline user experience across all interfaces

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 11:26:10 -03:00

148 lines
No EOL
4.8 KiB
PHP

<?php
/**
* Direct test of Find a Trainer functionality
* Upload to staging server and access via browser to test
*/
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
echo "<h1>Find a Trainer Direct Test</h1>";
// Try to load WordPress
$wp_load_paths = [
__DIR__ . '/../../../wp-load.php',
__DIR__ . '/../../../../wp-load.php',
dirname(__DIR__) . '/../../../wp-load.php'
];
$wp_loaded = false;
foreach ($wp_load_paths as $path) {
if (file_exists($path)) {
try {
require_once $path;
$wp_loaded = true;
echo "<p style='color:green'>✓ WordPress loaded from: $path</p>";
break;
} catch (Exception $e) {
echo "<p style='color:red'>✗ Failed to load WordPress from: $path - " . $e->getMessage() . "</p>";
}
} else {
echo "<p style='color:orange'>- wp-load.php not found at: $path</p>";
}
}
if (!$wp_loaded) {
die('<p style="color:red">FATAL: Could not load WordPress</p>');
}
// Test WordPress basics
echo "<h2>WordPress Environment Test</h2>";
echo "<p>WordPress version: " . get_bloginfo('version') . "</p>";
echo "<p>Site URL: " . get_site_url() . "</p>";
echo "<p>Plugin directory: " . WP_PLUGIN_DIR . "</p>";
// Test plugin loading
echo "<h2>Plugin Loading Test</h2>";
// Check if HVAC plugin is active
if (is_plugin_active('hvac-community-events/hvac-community-events.php')) {
echo "<p style='color:green'>✓ HVAC plugin is active</p>";
} else {
echo "<p style='color:red'>✗ HVAC plugin is NOT active</p>";
}
// Check if HVAC plugin function exists
if (function_exists('hvac_community_events')) {
echo "<p style='color:green'>✓ hvac_community_events function exists</p>";
try {
$plugin = hvac_community_events();
echo "<p style='color:green'>✓ Plugin instance created: " . get_class($plugin) . "</p>";
} catch (Exception $e) {
echo "<p style='color:red'>✗ Plugin instantiation failed: " . $e->getMessage() . "</p>";
}
} else {
echo "<p style='color:red'>✗ hvac_community_events function does not exist</p>";
}
// Test Find a Trainer class
echo "<h2>Find a Trainer Class Test</h2>";
if (class_exists('HVAC_Find_Trainer_Page')) {
echo "<p style='color:green'>✓ HVAC_Find_Trainer_Page class exists</p>";
try {
$find_trainer = HVAC_Find_Trainer_Page::get_instance();
echo "<p style='color:green'>✓ Find a Trainer instance created</p>";
} catch (Exception $e) {
echo "<p style='color:red'>✗ Find a Trainer instantiation failed: " . $e->getMessage() . "</p>";
}
} else {
echo "<p style='color:red'>✗ HVAC_Find_Trainer_Page class does not exist</p>";
}
// Check file existence
echo "<h2>File Existence Test</h2>";
$critical_files = [
'hvac-community-events.php',
'includes/class-hvac-plugin.php',
'includes/find-trainer/class-hvac-find-trainer-page.php',
'includes/find-trainer/class-hvac-mapgeo-integration.php',
'assets/css/find-trainer.css',
'assets/js/find-trainer.js'
];
$plugin_dir = WP_PLUGIN_DIR . '/hvac-community-events/';
foreach ($critical_files as $file) {
$full_path = $plugin_dir . $file;
if (file_exists($full_path)) {
echo "<p style='color:green'>✓ $file exists</p>";
} else {
echo "<p style='color:red'>✗ $file MISSING</p>";
}
}
// Test page existence
echo "<h2>Page Existence Test</h2>";
$page = get_page_by_path('find-a-trainer');
if ($page) {
echo "<p style='color:green'>✓ find-a-trainer page exists (ID: {$page->ID})</p>";
echo "<p>Page status: {$page->post_status}</p>";
echo "<p>Page title: {$page->post_title}</p>";
} else {
echo "<p style='color:red'>✗ find-a-trainer page does not exist in database</p>";
}
// Test direct URL
echo "<h2>URL Test</h2>";
$find_trainer_url = home_url('/find-a-trainer/');
echo "<p>Expected URL: <a href='$find_trainer_url' target='_blank'>$find_trainer_url</a></p>";
// Test shortcodes
echo "<h2>Shortcode Test</h2>";
if (shortcode_exists('hvac_find_trainer')) {
echo "<p style='color:green'>✓ hvac_find_trainer shortcode exists</p>";
} else {
echo "<p style='color:red'>✗ hvac_find_trainer shortcode does not exist</p>";
}
if (shortcode_exists('hvac_trainer_directory')) {
echo "<p style='color:green'>✓ hvac_trainer_directory shortcode exists</p>";
} else {
echo "<p style='color:red'>✗ hvac_trainer_directory shortcode does not exist</p>";
}
echo "<h2>Memory and Environment</h2>";
echo "<p>Memory usage: " . number_format(memory_get_usage() / 1024 / 1024, 2) . " MB</p>";
echo "<p>Memory limit: " . ini_get('memory_limit') . "</p>";
echo "<p>Max execution time: " . ini_get('max_execution_time') . "</p>";
echo "<h2>Test Complete</h2>";
echo "<p>If all tests pass but the page still shows error, check the server error logs for specific PHP errors.</p>";