service = app('LogisticService'); $baseCustomers = OracleBasCustomer::query() ->selectRaw('Customer_Type,CustomerID,Descr_C') ->where('Customer_Type','CA') ->get(); $this->data['baseCustomers'] = $baseCustomers; $this->data['codes'] = $baseCustomers->map(function($baseCustomer){ return $baseCustomer->customerid; }); } /** * @test */ public function getLogisticByCodes() { $logistics = $this->service->getLogisticByCodes($this->data['codes']); $this->assertNotEmpty($logistics); foreach ($logistics as $logistic) { $baseCustomer = $this->data['baseCustomers']->where('customerid',$logistic->code)->where('descr_c',$logistic->name); $this->assertNotEmpty($baseCustomer); $this->assertEquals(1,$baseCustomer->count()); } foreach ($this->data['baseCustomers'] as $baseCustomer) { $logistic = $logistics->where('code',$baseCustomer['customerid'])->where('name',$baseCustomer['descr_c']); $this->assertNotEmpty($logistic); $this->assertEquals(1,$logistic->count()); } } public function tearDown(): void { cache()->flush(); parent::tearDown(); // TODO: Change the autogenerated stub } }