<?php
/**
 * Smoke test with logging for HVAC Community Events plugin
 */
file_put_contents(__DIR__.'/smoke-test.log', "Starting smoke test...\n", FILE_APPEND);

// Simulate WordPress environment
define('WP_DEBUG', true);

try {
    // Load plugin directly
    require_once dirname(dirname(__DIR__)) . '/hvac-community-events.php';
    file_put_contents(__DIR__.'/smoke-test.log', "Plugin loaded successfully\n", FILE_APPEND);

    // Verify plugin loaded
    if (!class_exists('HVAC_Community_Events')) {
        throw new Exception("Plugin class not loaded");
    }

    // Verify version constant
    if (!defined('HVAC_CE_VERSION')) {
        throw new Exception("Version constant not defined");
    }

    // Verify TEC functions available (mocked by test-doubles)
    if (!function_exists('tribe_get_events')) {
        throw new Exception("TEC functions not available");
    }

    file_put_contents(__DIR__.'/smoke-test.log', "PASS: All checks completed successfully\n", FILE_APPEND);
    exit(0);

} catch (Exception $e) {
    file_put_contents(__DIR__.'/smoke-test.log', "FAIL: " . $e->getMessage() . "\n", FILE_APPEND);
    exit(1);
}