I'm trying to create an integration test for a website's authorization using Socialite. Everything works properly if I start the test with calling my AuthController
on handleProviderCallback()
method. But I want the process of testing to start with $this->visit('auth/facebook')
. When I'm trying to apply makePartial()
to my Socialite Provider mock there is no effect.
$provider = Mockery::mock('Laravel\Socialite\Contracts\Provider')->makePartial();
$provider->shouldReceive('user')
->andReturn($abstractUser)
->shouldIgnoreMissing();
Socialite::shouldReceive('driver')->with('facebook')->andReturn($provider);
(new AuthController())->redirectToProvider('facebook');
That being said, I want my code to use method user
of mocked Socialite
, but method redirect
- original Socialite
instance. I've tried to use:
$provider = Mockery::mock('Laravel\Socialite\Contracts\Provider')->makePartial();
and
$provider = Mockery::mock('Laravel\Socialite\Contracts\Provider[user]')
Nothing changes, whether I use any of the above, or not. Mockery still tries to call method redirect
on the mock of Socialite
.
Hope there's a way to solve this problem.
Aucun commentaire:
Enregistrer un commentaire