用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' => Car<div style="color:transparent">本&文来源gaodai^.ma#com搞#代!码网</div><strong>搞gaodaima代码</strong>bon::now());OperateLog::create($data);}</code>
请问这个应该如何处理?