jeudi 1 décembre 2016

PHPunit tests for socialite login with google

I am using socialite in my application so that users can login with their google accounts. I want to write a functional test for this. So far I have got up to clicking the button to login,

public function testAuth()
    {
        $this->visit('/admin')
            ->see('The Admin Dashboard')
            ->click('Login with Google')

            //tests to login should go here

            ->seePageIs('/admin/dashboard');
    }

from here a method calls the socialite google driver, checks if the google email is corporate, and creates an account for the user in the database who can then access the dashboard. The problem is even if I mock a user, the moment the tests hit this ->click('Login with Google') it sends a request to google and returns a request failed error



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire