service=app(StoreService::class); $data1=[ 'asn_code' => 'ASN2010210111', 'warehouse_id' =>2, 'owner_id' => 2, 'stored_method' =>'退货入库', 'status' =>'完全收货', 'remark' => 'test', 'created_at'=>'2020-11-06 14:32:00', 'updated_at'=>'2020-11-06 14:32:00', ]; array_push($this->params,$data1); $data2=[ 'asn_code' => 'ASN2010210222', 'warehouse_id' =>2, 'owner_id' => 2, 'stored_method' =>'退货入库', 'status' =>'完全收货', 'remark' => 'test', 'created_at'=>'2020-11-06 14:32:00', 'updated_at'=>'2020-11-06 14:32:00', ]; array_push($this->params,$data2); } public function testInsertStore(){ $this->service->insertStore($this->params); $this->assertDatabaseHas('stores',$this->params[0]); } public function tearDown(): void { DB::table('stores')->whereIn('asn_code',data_get($this->params,'*.asn_code'))->delete(); parent::tearDown(); // TODO: Change the autogenerated stub } }