When using Laravel to do unit tests, the error is as follows:
BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object
The local part code for the error is as follows:
function writeLog($record = ''){$data = array('uid' => Auth::user()->id,//调用这一行的时候报错'ip' => $this->request->ip(),'created_at' => Carbon::now());OperateLog::create($data);}
May I ask how this should be handled?
Reply content:
When using Laravel to do unit tests, the error is as follows:
BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object
The local part code for the error is as follows:
function writeLog($record = ''){$data = array('uid' => Auth::user()->id,//调用这一行的时候报错'ip' => $this->request->ip(),'created_at' => Carbon::now());OperateLog::create($data);}
May I ask how this should be handled?