<?php
/**
 * Test bootstrap file for HVAC Community Events plugin
 */

// Define test environment
define('HVAC_TEST_DIR', __DIR__);
define('HVAC_PLUGIN_DIR', dirname(__DIR__));
define('HVAC_DEBUG', true);

// Load WordPress test environment
require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/tests/bootstrap.php';

// Debug output
if (defined('HVAC_DEBUG') && HVAC_DEBUG) {
    error_log('[HVAC TEST] Loading test bootstrap');
}

// Load The Events Calendar plugin first
if (defined('HVAC_DEBUG') && HVAC_DEBUG) {
    error_log('[HVAC TEST] Loading TEC plugin');
}
$tec_path = dirname(dirname(dirname(__DIR__))) . '/the-events-calendar/the-events-calendar.php';
if (file_exists($tec_path)) {
    require_once $tec_path;
} else {
    error_log('[HVAC TEST ERROR] Could not find TEC plugin at: ' . $tec_path);
}

// Load test doubles
require_once __DIR__ . '/test-doubles.php';

// Load our plugin
if (defined('HVAC_DEBUG') && HVAC_DEBUG) {
    error_log('[HVAC TEST] Loading HVAC plugin');
}
require_once dirname(__DIR__) . '/hvac-community-events.php';

// Initialize plugins if needed
if (function_exists('tribe_events_community_plugin_loaded')) {
    tribe_events_community_plugin_loaded();
}

if (defined('HVAC_DEBUG') && HVAC_DEBUG) {
    error_log('[HVAC TEST] Bootstrap complete');
}