| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace Tests\Inventory\model;
- use App\InventoryAccount;
- use App\InventoryAccountMission;
- use Illuminate\Support\Str;
- use Tests\TestCase;
- class InventoryAccountTest extends TestCase
- {
- public $inventory;
- public $inventoryMission;
- function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->inventory=factory(InventoryAccount::class)->create();
- $this->inventoryMission=InventoryAccountMission::create([
- 'inventory_account_id'=>$this->inventory['id'],
- 'location'=>Str::random(5),
- 'commodity_id'=>256226,
- 'produced_at'=>null,
- 'valid_at'=>null,
- 'stored_at'=>null,
- 'batch_number'=>'',
- 'erp_type_position'=>'',
- 'quality'=>'',
- 'stored_amount'=>50,
- 'valid_amount'=>'',
- 'verified_amount'=>'',
- 're_checked_amount'=>'',
- 'difference_amount'=>'',
- 'occupied_amount'=>'',
- 'checked'=>'否',
- 'returned'=>'无',
- ]);
- }
- function testOwner(){
- $this->assertEquals($this->inventory['owner_id'],$this->inventory->owner['id']);
- }
- function testInventoryMissions(){
- $this->assertEquals($this->inventory->id,$this->inventoryMission['inventory_account_id']);
- }
- function testGetSurplusAttribute(){
- $surplus=$this->inventory['surplus'];
- $this->assertEquals($surplus,$this->inventory['total']-$this->inventory['processed']);
- }
- function tearDown(): void
- {
- InventoryAccountMission::where('inventory_account_id',$this->inventory['id'])->delete();
- InventoryAccount::where('id',$this->inventory['id'])->forceDelete();
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|