Test :: double不采取这种方法

时间:2018-05-18 17:46:07

标签: laravel laravel-4 mockery

我的DeveloperTinker上有一个静态方法,但是,当我运行它时,出现

  

[BadMethodCallException]
    调用未定义的方法Illuminate \ Database \ Query \ Builder :: firstName()

这是我的代码

 $mockUser = Mockery::mock('User');
 $mockUser -> shouldReceive("firstName")->with('1')->andReturn('Luis');
 Test::double('User', ["firstName" => $mockUser]);
 $userOP = User::firstName('user-51e06817-c03c822b');
 $this->info($userOP->firstName('1'));
 return;`

0 个答案:

没有答案