| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace Tests\Services\BatchService;
- use App\Batch;
- use App\Services\BatchService;
- use Tests\TestCase;
- class TestGetBatchByCodes extends TestCase
- {
- /** @var BatchService $service */
- private $service;
- private $data = [];
- public function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->service = app('BatchService');
- $batch = factory(Batch::class)->create();
- $this->data['batch'] = $batch;
- }
- /**
- * @test
- */
- public function getBatchByCodes()
- {
- $batch = $this->service->getBatchByCodes([$this->data['batch']['code']])->first();
- $this->assertNotNull($batch);
- $this->assertEquals($batch['code'],$this->data['batch']['code']);
- $this->assertEquals($batch['type'],$this->data['batch']['type']);
- $this->assertEquals($batch['wms_type'],$this->data['batch']['wms_type']);
- $this->assertEquals($batch['status'],$this->data['batch']['status']);
- $this->assertEquals($batch['wms_status'],$this->data['batch']['wms_status']);
- $this->assertEquals($batch['remark'],$this->data['batch']['remark']);
- $this->assertEquals($batch['owner_id'],$this->data['batch']['owner_id']);
- }
- public function tearDown(): void
- {
- $this->data['batch']->delete();
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|