| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace Tests\Services\StationTaskBatchService;
- use App\Services\StationTaskBatchService;
- use App\StationTask;
- use Tests\TestCase;
- class CreateByBatchesTest extends TestCase
- {
- /** @var StationTaskBatchService $service */
- private $service;
- private $data = [];
- public function setUp(): void
- {
- parent::setUp();
- $this->service = app('StationTaskBatchService');
- }
- // public function testCreateSuccess()
- // {
- // $amountToCreate=3;
- // $this->data['stationTasks']=$this->service->create($amountToCreate);
- // $this->assertEquals(Collection::class,get_class($this->data['stationTasks']));
- // $this->assertEquals($amountToCreate,$this->data['stationTasks']->count());
- // $this->assertEquals(StationTask::class,get_class($this->data['stationTasks'][0]));
- // }
- public function tearDown(): void
- {
- StationTask::query()->whereIn('id',data_get($this->data['stationTasks'],'*.id')??[])->delete();
- parent::tearDown();
- }
- }
|