CreateByBatchesTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Tests\Services\StationTaskBatchService;
  3. use App\Services\StationTaskBatchService;
  4. use App\StationTask;
  5. use Tests\TestCase;
  6. class CreateByBatchesTest extends TestCase
  7. {
  8. /** @var StationTaskBatchService $service */
  9. private $service;
  10. private $data = [];
  11. public function setUp(): void
  12. {
  13. parent::setUp();
  14. $this->service = app('StationTaskBatchService');
  15. }
  16. // public function testCreateSuccess()
  17. // {
  18. // $amountToCreate=3;
  19. // $this->data['stationTasks']=$this->service->create($amountToCreate);
  20. // $this->assertEquals(Collection::class,get_class($this->data['stationTasks']));
  21. // $this->assertEquals($amountToCreate,$this->data['stationTasks']->count());
  22. // $this->assertEquals(StationTask::class,get_class($this->data['stationTasks'][0]));
  23. // }
  24. public function tearDown(): void
  25. {
  26. StationTask::query()->whereIn('id',data_get($this->data['stationTasks'],'*.id')??[])->delete();
  27. parent::tearDown();
  28. }
  29. }