orderService = app('OrderService'); } /** * @test */ public function createOrFindOrder() { $orderHeader = OracleDOCOrderHeader::query() ->where('sostatus',99) ->whereNotNull('issuepartyname') ->whereNotNull('userdefine1') ->orderByDesc('addtime') ->first(); $baseCustomer = OracleBasCustomer::query() ->selectRaw('Customer_Type,CustomerID,Descr_C') ->where('Customer_Type','CA') ->where('CustomerID',$orderHeader->userdefine1)->first(); Logistic::query()->firstOrCreate(['code'=>$orderHeader->userdefine1,'name'=>$baseCustomer->descr_c]); $owner = Owner::query()->firstOrCreate(['code'=>$orderHeader->customerid,'name'=>'']); Shop::query()->firstOrCreate(['name'=>$orderHeader->issuepartyname,'owner_id'=>$owner->id]); app('WarehouseService')->firstOrCreate(["code"=>$orderHeader->warehouseid],["code"=>$orderHeader->warehouseid,"name"=>$orderHeader->warehouseid]); $this->assertNotNull($orderHeader); $this->orderService->createOrFindOrder($orderHeader); $order = Order::query()->where('code',$orderHeader->orderno)->first(); $this->assertNotNull($order); $this->assertEquals($order->code,$orderHeader->orderno); $this->assertEquals((string)$order->created_at,(string)$orderHeader->addtime); $this->assertEquals((string)$order->wms_edittime,(string)$orderHeader->edittime); } public function tearDown(): void { cache()->flush(); parent::tearDown(); // TODO: Change the autogenerated stub } }