service = app('StationTaskBatchService'); $this->stationTaskService = app('StationTaskService'); $this->data['batches'] = factory(Batch::class, self::AmountOfBatch) ->create(); $this->data['stationTasks'] = $this->stationTaskService->create(self::AmountOfBatch); } public function testReturned() { $this->data['stationTaskBatches']=$this->service->createByBatches($this->data['batches'], $this->data['stationTasks']); $this->assertEquals(self::AmountOfBatch, $this->data['stationTaskBatches']->count()); } public function tearDown(): void { Batch::query()->whereIn('id',data_get($this->data['batches'],'*.id')??[])->delete(); StationTask::query()->whereIn('id',data_get($this->data['stationTasks'],'*.id')??[])->delete(); StationTaskBatch::query()->whereIn('id',data_get($this->data['stationTaskBatches'],'*.id')??[])->delete(); parent::tearDown(); } }