service = app('WarehouseService'); $basCustomers = OracleBasCustomer::query()->selectRaw('CustomerId,Descr_C')->where('Customer_Type','WH')->get(); $this->data['basCustomers'] = $basCustomers; $this->data['codes'] = $basCustomers->map(function ($basCustomer){ return $basCustomer->customerid; }); } /** * @test */ public function getWareHouseByCodeTest() { $wareHouses = $this->service->getWareHouseByCode($this->data['codes']); $this->assertNotEmpty($wareHouses); foreach ($wareHouses as $wareHouse) { $basCustomer = $this->data['basCustomers']->where('customerid',$wareHouse->code)->where('descr_c',$wareHouse->name); $this->assertNotEmpty($basCustomer); } foreach ($this->data['basCustomers'] as $basCustomer) { $wareHouse = $wareHouses->where('name',$basCustomer['descr_c'])->where('code',$basCustomer['customerid']); $this->assertNotEmpty($wareHouse); } } public function tearDown(): void { cache()->flush(); parent::tearDown(); // TODO: Change the autogenerated stub } }