service = app(OwnerAreaReportService::class); $this->data = factory(OwnerAreaReport::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 testUpdate(){ $model = $this->data[0]; $result = $this->service->update(["id"=>$model->id],[ "accounting_area" => 1000, ]); $this->assertEquals(true,$result); $area = OwnerAreaReport::query()->find($model->id); $this->assertNotNull($area); $this->assertEquals(1000,$area->accounting_area); } public function testGet(){ $ids = implode(",",array_column($this->data->toArray(),"owner_id")); $models = $this->service->get(["owner_id"=>$ids]); $this->assertGreaterThanOrEqual(3,count($models)); } public function testTruncate(){ OwnerAreaReport::query()->truncate(); $models = OwnerAreaReport::query()->get(); $this->assertCount(0,$models); } }