service = app('LogisticService'); $logistic = factory(Logistic::class)->create(); $basCustomer = factory(OracleBasCustomer::class)->make(["customer_type"=>'OW',"customerid"=>$logistic->code]); $this->data['basCustomers'] = $basCustomer; $this->data['logistic'] = $logistic; $this->mock('OracleBasCustomerService',function ($mock)use($basCustomer){ $mock->shouldReceive('first')->andReturn($basCustomer); }); } /** * @test */ public function getLogisticByCode() { $logistic = $this->service->getLogisticByCode($this->data['logistic']['code']); $this->assertEquals($logistic->id,$this->data['logistic']['id']); $this->assertEquals($logistic->code,$this->data['logistic']['code']); $this->assertEquals($logistic->name,$this->data['logistic']['name']); } public function tearDown(): void { cache()->forget('getLogisticByCode_'.$this->data['logistic']['code']); $this->data['logistic']->forceDelete(); parent::tearDown(); // TODO: Change the autogenerated stub } }