AssignTasksTest.php 870 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Tests\Services\BatchService;
  3. use App\Services\BatchService;
  4. use Tests\TestCase;
  5. use App\Batch;
  6. use App\Traits\TestMockSubServices;
  7. class AssignTasksTest extends TestCase
  8. {
  9. use TestMockSubServices;
  10. /** @var BatchService $service */
  11. public $service;
  12. private $data;
  13. private $amount=2;
  14. function setUp(): void
  15. {
  16. parent::setUp();
  17. $this->service = app('BatchService');
  18. $this->data['Batches']
  19. = factory(Batch::class, $this->amount)
  20. ->create();
  21. }
  22. public function testReturned()
  23. {
  24. $this->service->assignTasks($this->data['Batches']);
  25. $this->assertTrue(true);
  26. }
  27. function tearDown(): void
  28. {
  29. Batch::query()
  30. ->whereIn('id',data_get($this->data['Batches'],'*.id')??[])
  31. ->delete();
  32. parent::tearDown();
  33. }
  34. }