service = app('CommodityService'); $owner = factory(Owner::class)->create(); $commodity=factory(Commodity::class)->create(['owner_id'=>$owner->id]); $this->data['owner'] = $owner; $this->data['commodity'] = $commodity; } public function testGet_OnlyOwnerIds() { $commodities=$this->service->get_([$this->data['commodity']['owner_id']]); $this->assertNotNull($commodities); $this->assertEquals($this->data['commodity']['sku'],$commodities->first()['sku']); } public function tearDown(): void { $commodity_id=Commodity::query()->where('owner_id',$this->data['commodity']['owner_id'])->value('id'); Commodity::query()->where('owner_id',$this->data['owner']['id'])->delete(); CommodityBarcode::query()->where('commodity_id',$commodity_id)->delete(); $this->data['owner']->delete(); $this->data['commodity']->delete(); parent::tearDown(); // TODO: Change the autogenerated stub } }