<?php

use Carbon\Carbon;
use App\Jobs\QueuedCommand;
use Illuminate\Support\Facades\Artisan;

require_once realpath(dirname(__FILE__) . '/TestCase.php');

Artisan::queue('real:sync-company');
Artisan::queue('real:sync-package');
Artisan::queue('real:sync-flow-pool');

$datetime = Carbon::parse('2017-04-01');

call('real:sync-order');
call('real:sync-added-order');
call('real:sync-refund');

function call($command)
{
    $datetime = Carbon::parse('2017-04-01');

    while (true) {
        Artisan::queue($command, [
            'month' => $datetime->format('Y-m'),
        ]);

        $datetime->addMonth();

        if ($datetime > Carbon::now()) {
            break;
        }
    }
}
