TestGetBatchByCodes.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Tests\Services\BatchService;
  3. use App\Batch;
  4. use App\Services\BatchService;
  5. use Tests\TestCase;
  6. class TestGetBatchByCodes extends TestCase
  7. {
  8. /** @var BatchService $service */
  9. private $service;
  10. private $data = [];
  11. public function setUp(): void
  12. {
  13. parent::setUp(); // TODO: Change the autogenerated stub
  14. $this->service = app('BatchService');
  15. $batch = factory(Batch::class)->create();
  16. $this->data['batch'] = $batch;
  17. }
  18. /**
  19. * @test
  20. */
  21. public function getBatchByCodes()
  22. {
  23. $batch = $this->service->getBatchByCodes([$this->data['batch']['code']])->first();
  24. $this->assertNotNull($batch);
  25. $this->assertEquals($batch['code'],$this->data['batch']['code']);
  26. $this->assertEquals($batch['type'],$this->data['batch']['type']);
  27. $this->assertEquals($batch['wms_type'],$this->data['batch']['wms_type']);
  28. $this->assertEquals($batch['status'],$this->data['batch']['status']);
  29. $this->assertEquals($batch['wms_status'],$this->data['batch']['wms_status']);
  30. $this->assertEquals($batch['remark'],$this->data['batch']['remark']);
  31. $this->assertEquals($batch['owner_id'],$this->data['batch']['owner_id']);
  32. }
  33. public function tearDown(): void
  34. {
  35. $this->data['batch']->delete();
  36. parent::tearDown(); // TODO: Change the autogenerated stub
  37. }
  38. }