subSeconds(300); $this->service=app(RejectedBillService::class); $this->asnHeaders=OracleDOCASNHeader::query() ->with(['asnType', 'asnStatus', 'asnDetails' => function ($query) { $query->with(['lineStatus', 'qualityStatus','basSku']); }]) ->where('addTime', '>=', $startDate) ->get(); } /** * @test */ public function testSyncLoadedStatusByAsnHeaderTest(){ if (empty($this->asnHeaders)){ $this->assertNull($this->asnHeaders); return; } $updateCollect=$this->service->getUpdateCollect($this->asnHeaders); if ($updateCollect->isEmpty()){ $this->assertEmpty($updateCollect); return; } $logisticNumberReturn=$this->service->getLogisticNumberReturn($updateCollect); if (count($logisticNumberReturn)==0) return; $rejectedBills=$this->service->getRejectedBills($logisticNumberReturn); if ($rejectedBills->isEmpty()){ $this->assertEmpty($rejectedBills); return null; } $this->assertNotNull($rejectedBills); $this->params=[]; $updateParams=$this->service->getNeedUpdateLoadedStatusByWms($this->asnHeaders); array_shift($updateParams); if (count($updateParams)>=1){ foreach ($updateParams as $param){ $this->params[] = $param['logistic_number_return']; } $this->service->syncLoadedStatusByAsnHerder($this->asnHeaders); } $this->assertNotNull($logisticNumberReturn); } public function tearDown(): void { if (!$this->params)return; $rejectBills=RejectedBill::query()->whereIn('logistic_number_return', $this->params)->get(); foreach ($rejectBills as $rejectBill){ $rejectBill->is_loaded=0; $rejectBill->update(); } parent::tearDown(); // TODO: Change the autogenerated stub } }