0
我想在我的應用程序中使用Facebook,Twitter和github測試我的社交身份驗證。我使用了Socialte和Laravel 5.1。PHP致命錯誤:調用未定義的方法Laravel Socialite Contracts Factory :: shouldReceive()
這是我在測試socilate嘗試:
use Laravel\Socialite\Contracts\Factory as Socialite;
class AuthTests extends TestCase
{
public function testFb()
{
Socialite::shouldReceive('driver')->once()->with('facebook')->andReturn('code');
$this->visit('/auth/login/facebook');
}
}
但這從未成功運行,我不斷收到此錯誤:
[Symfony\Component\Debug\Exception\FatalErrorException]Call to undefined method Laravel\Socialite\Contracts\Factory::shouldReceive()
我到處都找過了,我可以用它來的方式在我的測試中成功地模擬了Socialite,但找不到任何東西。
在我的控制器:
private function getAuthorizationFirst($provider)
{
return $this->socialite->driver($provider)->redirect();
}
這是我試圖嘲弄。社交名流應該通過提供商'臉譜'收到方法'驅動程序'並返回一些內容。
我很確定我錯過了一些事情也許!
反饋太讚賞了!