<?php


namespace Tests\Inventory\Services\InventoryAccountService;


use App\InventoryAccount;
use App\Services\InventoryAccountService;
use Tests\TestCase;

class InventoryAccountService_SomeTest extends TestCase
{
    public $inventories;
    public $inventorys;
    public $queryParam=[];
    public $first;
    public $second;
    function setUp(): void
    {
        parent::setUp(); // TODO: Change the autogenerated stub
        $this->first=factory(InventoryAccount::class)->create();
        $this->second=factory(InventoryAccount::class)->create();
    }

    function testSome(){
        $this->queryParam=[
            'data'=>'"'.$this->first['id'].','.$this->second['id'].'"',
        ];
        $inventoryService=new InventoryAccountService();
        $this->inventories=$inventoryService->some($this->queryParam);
        $this->inventorys=InventoryAccount::query()->with(['owner'])->orderBy('id','DESC')
            ->whereIn('id',explode(',','"'.$this->first['id'].','.$this->second['id'].'"'))->get();
        $this->assertEquals(count($this->inventorys),count($this->inventories));
        $this->assertEquals($this->inventorys,$this->inventories);
    }
    function tearDown(): void
    {
        InventoryAccount::where('id',$this->first['id'])->forceDelete();
        InventoryAccount::where('id',$this->second['id'])->forceDelete();
        parent::tearDown(); // TODO: Change the autogenerated stub
    }


}

