<?php

namespace Tests\Services\OrderService\GetParamByOrderHeaderTest;

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

class GetParamByOrderHeaderTest extends TestCase
{
    /** @var OrderService $service */
    public $service;
    public function setUp(): void
    {
        parent::setUp();
        $this->service = app(OrderService::class);
    }

    public function testGetParamByOrderHeader()
    {
        $orderHeader = OracleDOCOrderHeader::query()
            ->with('actAllocationDetails')
            ->orderByDesc('AddTime')->first();
        $param = $this->service->getParamByOrderHeader($orderHeader);
        $this->assertNotNull($param);
        $this->assertNotEmpty($param['code']);
        $this->assertNotEmpty($param['owner_id']);
        $this->assertNotNull($param['logistic_id']);
        $this->assertNotEmpty($param['consignee_name']);
        $this->assertNotEmpty($param['consignee_phone']);
        $this->assertNotEmpty($param['province']);
        $this->assertNotEmpty($param['city']);
        $this->assertNotEmpty($param['district']);
        $this->assertNotEmpty($param['address']);
        $this->assertNotEmpty($param['client_code']);
        $this->assertNotEmpty($param['wms_edittime']);
        $this->assertNotEmpty($param['wms_status']);
        $this->assertNotEmpty($param['updated_at']);
        $this->assertNotEmpty($param['created_at']);
        $this->assertNotEmpty($param['warehouse_id']);
    }
}
