<?php


namespace Tests\Services\CommodityService;


use App\OracleBasSKU;
use App\Services\CommodityService;
use App\Services\OwnerService;
use App\Store;
use Tests\TestCase;

class GetParamsByBasSkusTest extends TestCase
{
    /**
     * @var CommodityService $service
     * @var OwnerService $ownerService
     *
     */
    public $service;
    public $bas_skus;
    public $ownerService;
    public function setUp(): void
    {
        parent::setUp(); // TODO: Change the autogenerated stub
        $startDate = \Illuminate\Support\Carbon::now()->subSeconds(300);
        $this->service=app(CommodityService::class);
        $this->ownerService=app(OwnerService::class);
        $this->bas_skus=OracleBasSKU::query()
            ->select('customerid','sku','descr_c','alternate_sku1','alternate_sku2','alternate_sku3','skulength','skuwidth','skuhigh','cube','packid','addtime','edittime')
            ->where('addTime', '>=', $startDate)
            ->orderByDesc('addtime')
            ->get();
    }
    public function testGetParamsByBasSkus(){
        if ($this->bas_skus->isEmpty()) {
            $this->assertEmpty($this->bas_skus);
            $insert_params=$this->service->getParamsByBasSkus($this->bas_skus);
            $this->assertNull($insert_params);
        }else{
            $insert_params=$this->service->getParamsByBasSkus($this->bas_skus);
            $this->assertNotNull($insert_params);
        }
    }
}
