- Add HVAC_Test_User_Factory class with: * User creation with specific roles * Multiple role support * Persona management system * Account cleanup integration - Create comprehensive test suite in HVAC_Test_User_Factory_Test.php - Update testing improvement plan documentation - Add implementation decisions to project memory bank - Restructure .gitignore with: * Whitelist approach for better file management * Explicit backup exclusions * Specific bin directory inclusions Part of the Account Management component from the testing framework improvement plan.
		
			
				
	
	
		
			99 lines
		
	
	
		
			No EOL
		
	
	
		
			2.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			No EOL
		
	
	
		
			2.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Test doubles for The Events Calendar functionality
 | |
|  */
 | |
| 
 | |
| // Mock TEC main class if not present
 | |
| if (!class_exists('Tribe__Events__Main')) {
 | |
|     class Tribe__Events__Main {
 | |
|         const POSTTYPE = 'tribe_events';
 | |
|         const VENUE_POST_TYPE = 'tribe_venue';
 | |
|         const ORGANIZER_POST_TYPE = 'tribe_organizer';
 | |
|         
 | |
|         public static function instance() {
 | |
|             static $instance;
 | |
|             if (!$instance) {
 | |
|                 $instance = new self();
 | |
|             }
 | |
|             return $instance;
 | |
|         }
 | |
|         
 | |
|         public function getOption($key, $default = '') {
 | |
|             return $default;
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| // Mock Community Events class if not present
 | |
| if (!class_exists('Tribe__Events__Community__Main')) {
 | |
|     class Tribe__Events__Community__Main {
 | |
|         public static function instance() {
 | |
|             static $instance;
 | |
|             if (!$instance) {
 | |
|                 $instance = new self();
 | |
|             }
 | |
|             return $instance;
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| // Mock essential TEC functions
 | |
| if (!function_exists('tribe_get_events')) {
 | |
|     function tribe_get_events($args = array()) {
 | |
|         error_log('[HVAC TEST] Mock tribe_get_events called with args: ' . print_r($args, true));
 | |
|         return get_posts(array_merge(array(
 | |
|             'post_type' => Tribe__Events__Main::POSTTYPE,
 | |
|             'posts_per_page' => -1
 | |
|         ), $args));
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (!function_exists('tribe_get_start_date')) {
 | |
|     function tribe_get_start_date($event_id = null, $display_time = true, $date_format = '') {
 | |
|         return get_post_meta($event_id, '_EventStartDate', true);
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (!function_exists('tribe_get_end_date')) {
 | |
|     function tribe_get_end_date($event_id = null, $display_time = true, $date_format = '') {
 | |
|         return get_post_meta($event_id, '_EventEndDate', true);
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (!function_exists('tribe_get_venue')) {
 | |
|     function tribe_get_venue($post_id = null) {
 | |
|         return get_post_meta($post_id, '_EventVenue', true);
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (!function_exists('tribe_get_organizer')) {
 | |
|     function tribe_get_organizer($post_id = null) {
 | |
|         return get_post_meta($post_id, '_EventOrganizer', true);
 | |
|     }
 | |
| }
 | |
| 
 | |
| // Mock WordPress functions if needed for testing
 | |
| if (!function_exists('wp_verify_nonce')) {
 | |
|     function wp_verify_nonce($nonce, $action = -1) {
 | |
|         return true; // Always verify in test environment
 | |
|     }
 | |
| }
 | |
| 
 | |
| if (!function_exists('wp_create_nonce')) {
 | |
|     function wp_create_nonce($action = -1) {
 | |
|         return 'test_nonce';
 | |
|     }
 | |
| }
 | |
| 
 | |
| // Add test helper functions
 | |
| function create_test_event($args = array()) {
 | |
|     $default_args = array(
 | |
|         'post_type' => Tribe__Events__Main::POSTTYPE,
 | |
|         'post_title' => 'Test Event',
 | |
|         'post_status' => 'publish'
 | |
|     );
 | |
|     return wp_insert_post(array_merge($default_args, $args));
 | |
| }
 | |
| 
 | |
| // Log that test doubles are loaded
 | |
| error_log('[HVAC TEST] Test doubles loaded successfully'); |