laravel单元测试的时候报错


用laravel做单元测试的时候报错如下:
BadMethodCallException: Method Mockery_0_Illuminate_Auth_AuthManager::user() does not exist on this mock object
报错的地方部分代码如下:
function writeLog($record = ''){
$data = array(
'uid' => Auth::user()->id,//调用这一行的时候报错
'ip' => $this->request->ip(),
'created_at' => Carbon::now()
);
OperateLog::create($data);
}
请问这个应该如何处理?


Vote Vote Cancel Collect Collect Cancel

<< 上一篇: 请问token是应该放在http header里嘛?

>> 下一篇: These credentials do not match our records.