<?php

namespace Tests\Services\OrderService\FindOrCreateByClientCodeTest;

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

class FindOrCreateByClientCodeTest extends TestCase
{
    /** @var OrderService $service */
    public $service;

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

    public function testFindOrCreateByClientCode()
    {
        $clientCode = OracleDOCOrderHeader::query()->first()->soreference1;
        $order =  $this->service->findOrCreateByClientCode($clientCode);
        $this->assertNotEmpty($clientCode);
        $this->assertNotEmpty($order);
        $this->assertNotEmpty($order->client_code);
        $this->assertNotEmpty($order->warehouse_id);
    }
}
