<?php

it('registers economic transfer queue cron task and handler', function (): void {
    $content = file_get_contents(app_path('cron/Cron.php'));

    expect($content)->not->toBeFalse();
    expect($content)->toContain("require_once __DIR__ . '/../classes/economic_transfer_executor.php';");
    expect($content)->toContain("require_once __DIR__ . '/../classes/economic_transfer_queue_schema_bootstrap.php';");
    expect($content)->toContain("require_once __DIR__ . '/../classes/economic_transfer_queue.php';");
    expect($content)->toContain("'EconomicTransferQueueCron'");
    expect($content)->toContain("'function' => 'EconomicTransferQueueCron'");
    expect($content)->toContain('function EconomicTransferQueueCron(): void');
    expect($content)->toContain('new economic_transfer_queue()');
    expect($content)->toContain('processPending(10)');
});

it('wires queue worker class loading for CLI queue action', function (): void {
    $content = file_get_contents(app_path('cli.php'));

    expect($content)->not->toBeFalse();
    expect($content)->toContain("require_once __DIR__ . '/classes/economic_transfer_executor.php';");
    expect($content)->toContain("require_once __DIR__ . '/classes/economic_transfer_queue_schema_bootstrap.php';");
    expect($content)->toContain("require_once __DIR__ . '/classes/economic_transfer_queue.php';");
    expect($content)->toContain("case 'economic-transfer-queue':");
    expect($content)->toContain('new \\classes\\economic_transfer_queue()');
});
