<?php

it('delegates automatic cron execution to the db-backed scheduler', function (): void {
    $content = file_get_contents(app_path('cron/Cron.php'));

    expect($content)->not->toBeFalse();
    expect($content)->toContain('CRON_LOAD_LEGACY_FUNCTIONS_ONLY');
    expect($content)->toContain("new \\classes\\cron_scheduler())->runDue('automatic')");
    expect($content)->toContain('function EconomicTransferQueueCron(): void');
    expect($content)->toContain('function GoalsProgressAlertsCron(): void');
});

it('only rewrites htaccess when the compatibility file changes', function (): void {
    $content = file_get_contents(app_path('cron.php'));

    expect($content)->not->toBeFalse();
    expect($content)->toContain('file_get_contents($htaccessPath) !== $htaccess');
    expect($content)->toContain('file_put_contents($htaccessPath, $htaccess)');
});
