AllocationLaborToLaborCompanyTest.php 1.0 KB

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