I've implemented Laravel socialite authentication and I'm trying to write a test to the login flow
I have the two functions: redirectToProvider and handleProviderCallback
public function redirectToProvider($provider)
{
return Socialite::driver($provider)->redirect();
}
public function handleProviderCallback($provider)
{
//
}
I have successfully written the test for the second method handleProviderCallback by using this gist and ajusting it for my need
what I need now is just how I call my route /login/github and redirects me to /login/github/callback
Also testing socialite isn't really a good thing, since you're testing a third party package right? The package already has tests, so there wouldn't be a need to test if the correct urls are generated. Instead you would want to test the full integration with a third-party website. That is not something you put in a unit test.
I'm not testing the socialite package itself I'm testing the redirect flow from the first function call to the second one
As far as i know I assume i should get a RedirectResponse when i hit redirectToProvider and then I can easily get the redirect url but I didn't get that, that's what confuse me