stationCacheShelfGridService = app(StationCacheShelfGridService::class); $this->data['grids'] = factory(StationCacheShelfGrid::class)->times(3)->create(); } public function testCancelTask() { $this->stationCacheShelfGridService->cancelTask($this->data['grids']); $grids = StationCacheShelfGrid::query()->whereIn('id',data_get($this->data['grids'],'*.id'))->whereNull('material_box_id')->where('status',0)->count(); $this->assertEquals($grids, count($this->data['grids'])); } protected function tearDown(): void { StationCacheShelfGrid::query()->where('id',data_get($this->data['grids'],'*.id'))->delete(); parent::tearDown(); } }