service=app(StoreService::class); $this->asnHeaders=OracleDOCASNHeader::query() ->with(['asnType', 'asnStatus', 'asnDetails' => function ($query) { $query->with(['lineStatus', 'qualityStatus','basSku']); }]) ->where('addTime', '>=', Carbon::parse('2020-10-21 00:00:00')->format('Y-m-d H:i:s')) ->get(); } public function testCreateStore(){ if (!$this->asnHeaders) return null; $this->stores=$this->service->createStore($this->asnHeaders); $this->assertNotEmpty($this->stores); } public function tearDown(): void { $storeIds=[]; foreach ($this->stores as $store){ array_push($storeIds,$store->id); } DB::table('stores')->whereIn('asn_code',data_get($this->asnHeaders,'*.asnno'))->delete(); DB::table('store_items')->whereIn('store_id',$storeIds)->delete(); parent::tearDown(); // TODO: Change the autogenerated stub } }