| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace Tests\Inventory\Services\InventoryService;
- use App\Inventory;
- use App\Services\InventoryService;
- use Tests\TestCase;
- class InventoryService_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(Inventory::class)->create();
- $this->second=factory(Inventory::class)->create();
- }
- function testSome(){
- $this->queryParam=[
- 'data'=>'"'.$this->first['id'].','.$this->second['id'].'"',
- ];
- $inventoryService=new InventoryService();
- $this->inventories=$inventoryService->some($this->queryParam);
- $this->inventorys=Inventory::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
- {
- Inventory::where('id',$this->first['id'])->forceDelete();
- Inventory::where('id',$this->second['id'])->forceDelete();
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|