I have an application that makes use of socialite, I want to create test for Github authentication, So I used Socialite Facade to mock call to the Socialite
public function testGithubLogin()
public function authorizeProvider($provider)
Well, both answers were great, but they have lots of codes that are not required, and I was able to infer my answer from them.
This is all I needed to do.
Firstly mock the Socialite User type
$abstractUser = Mockery::mock('Laravel\Socialite\Two\User')
Second, set the expected values for its method calls
$abstractUser ->shouldReceive('getId') ->andReturn(rand()) ->shouldReceive('getName') ->andReturn(str_random(10)) ->shouldReceive('getEmail') ->andReturn(str_random(10) . '@gmail.com') ->shouldReceive('getAvatar') ->andReturn('https://en.gravatar.com/userimage');
Then lastly you write your assertions