<?php

namespace Tests\Services\OracleDOCOrderHeaderService\GetWmsOrderOnStartDateCreateTest;

use App\OracleDOCOrderHeader;
use App\Services\OracleDOCOrderHeaderService;
use Carbon\Carbon;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;

class GetWmsOrderOnstartDateCreateTest extends TestCase
{
    /** @var OracleDOCOrderHeaderService $service */
    public $service;

    public function setUp(): void
    {
        $this->service = app(OracleDOCOrderHeaderService::class);
        parent::setUp();
    }

    public function testGetWmsOrderOnstartDateCreate()
    {
        $carbon =Carbon::now()->subHours(10);
        $orderHeaders = $this->service->getWmsOrderOnStartDateCreate($carbon);
        $this->assertNotNull($orderHeaders);
        $orderHeader = $orderHeaders->first();
        if($orderHeaders->count() == 0){
            return ;
        }
        $this->assertNotNull($orderHeader->oracleDOCOrderDetails);
        $this->assertNotNull($orderHeader->actAllocationDetails);
        $this->assertNotNull($orderHeader->oracleBASCustomer);
        $this->assertNotNull($orderHeader->oracleBASCode);
    }
}
