GetBatches_shouldProcessTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Tests\Unit\StationRuleBatchService;
  3. use App\Batch;
  4. use App\Owner;
  5. use App\Services\BatchService;
  6. use App\Services\OwnerService;
  7. use App\Services\StationRuleBatchService;
  8. use App\StationRuleBatch;
  9. use Tests\TestCase;
  10. class GetBatches_shouldProcessTest extends TestCase
  11. {
  12. /** @var StationRuleBatchService $service */
  13. private $service;
  14. /** @var BatchService $batchService */
  15. private $batchService;
  16. private $data = [];
  17. public function setUp(): void
  18. {
  19. parent::setUp();
  20. $this->service = app('StationRuleBatchService');
  21. $this->batchService = app('BatchService');
  22. $this->data['stationRuleBatches'] = factory(StationRuleBatch::class)
  23. ->create([]);
  24. $this->data['batches'] = factory(Batch::class,3)->create([
  25. ]);
  26. }
  27. /**
  28. * @test
  29. */
  30. public function getShopByCodeMap()
  31. {
  32. $shop = $this->service->getShopByCodeMap($this->data['map']);
  33. $this->assertNotNull($shop);
  34. $orderHeader = $this->data['orderHeader'];
  35. $owner = Owner::find($shop->first()->owner_id);
  36. $this->assertEquals($owner->code,$orderHeader['customerid']);
  37. $this->assertEquals($shop->first()->name,$orderHeader['issuepartyname']);
  38. }
  39. public function tearDown(): void
  40. {
  41. cache()->flush();
  42. parent::tearDown(); // TODO: Change the autogenerated stub
  43. }
  44. }