service = app(OwnerFeeDetailService::class); $this->data = factory(OwnerFeeDetail::class,3)->create(); } public function testPaginate() { $models = $this->service->paginate(array("paginate"=>5)); $this->assertGreaterThanOrEqual(3,count($models)); $this->assertLessThanOrEqual(5,count($models)); } public function testGetSql() { $ids = implode(",",array_column($this->data->toArray(),"id")); $sql = $this->service->getSql(["id"=>$ids]); $models = DB::select(DB::raw($sql)); $this->assertCount(3,$models); } public function testTruncate(){ OwnerFeeDetail::query()->truncate(); $models = OwnerFeeDetail::query()->get(); $this->assertCount(0,$models); } }