<?php
require_once __DIR__ . '/../../app/core/bootstrap.php';
$pdo = crm_pdo();

// Mock auth
$_SESSION['user_id'] = 1;
$_SESSION['user_role'] = 'admin';

$_GET['start'] = '2026-04-01';
$_GET['end'] = '2026-05-01';

try {
    ob_start();
    include __DIR__ . '/calendar_events.php';
    $out = ob_get_clean();
    echo "SUCCESS\n";
    echo substr($out, 0, 500);
} catch (Throwable $e) {
    echo "ERROR: " . $e->getMessage() . " at " . $e->getFile() . ":" . $e->getLine();
}
