When using laravel for unit testing, the following error is reported:
<code>BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object </code>
Part of the code where the error was reported is as follows:
<code>function writeLog($record = ''){ $data = array( 'uid' => Auth::user()->id,//调用这一行的时候报错 'ip' => $this->request->ip(), 'created_at' => Carbon::now() ); OperateLog::create($data); } </code>
How should I deal with this?
When using laravel for unit testing, the following error is reported:
<code>BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object </code>
Part of the code where the error was reported is as follows:
<code>function writeLog($record = ''){ $data = array( 'uid' => Auth::user()->id,//调用这一行的时候报错 'ip' => $this->request->ip(), 'created_at' => Carbon::now() ); OperateLog::create($data); } </code>
How should I deal with this?