<?php

namespace Tests\Services\OrderTrakingSerive\GetParamsByOrderHeaderAndOrderTest;

use App\OracleDOCOrderHeader;
use App\Order;
use App\Services\OrderService;
use App\Services\OrderTrackingService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;

class GetParamsByOrderHeaderAndOrderTest extends TestCase
{

    /** @var OrderTrackingService $service */
    public $service;

    public function setUp(): void
    {
        $this->service=app(OrderTrackingService::class);
        parent::setUp(); // TODO: Change the autogenerated stub
    }

    public function testGetParamsByOrderHeaderAndOrderTest()
    {
        /**
         * @var Order $order
         * @var OracleDOCOrderHeader $orderHeader
         */
        $order = Order::query()->first();
        $orderHeader = OracleDOCOrderHeader::query()->where('OrderNo',$order->code)->first();
        $this->assertNotEmpty($order);
        $this->assertNotEmpty($orderHeader);
        $orderTacking =  $this->service->getParamsByOrderHeaderAndOrder($orderHeader,$order);
        $this->assertNotEmpty($orderTacking);
        $this->assertNotEmpty($orderTacking['planning_sent_at']);
    }
}
