用laravel做單元測試的時候報錯如下:
<code>BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object </code>
報錯的地方部分代碼如下:
<code>function writeLog($record = ''){ $data = array( 'uid' => Auth::user()->id,//调用这一行的时候报错 'ip' => $this->request->ip(), 'created_at' => Carbon::now() ); OperateLog::create($data); } </code>
請問這個應該如何處理?
用laravel做單元測試的時候報錯如下:
<code>BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object </code>
報錯的地方部分代碼如下:
<code>function writeLog($record = ''){ $data = array( 'uid' => Auth::user()->id,//调用这一行的时候报错 'ip' => $this->request->ip(), 'created_at' => Carbon::now() ); OperateLog::create($data); } </code>
請問這個應該如何處理?