X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9af636bd48f5c7cec7f73746307800b9572d2644..refs/pull/2902/head:/tests/Auth/SocialAuthTest.php diff --git a/tests/Auth/SocialAuthTest.php b/tests/Auth/SocialAuthTest.php index 60de8fbcb..5818cbb74 100644 --- a/tests/Auth/SocialAuthTest.php +++ b/tests/Auth/SocialAuthTest.php @@ -1,4 +1,6 @@ -make(); @@ -43,7 +44,7 @@ class SocialAuthTest extends TestCase config([ 'GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', - 'APP_URL' => 'http://localhost' + 'APP_URL' => 'http://localhost', ]); $mockSocialite = $this->mock(Factory::class); @@ -60,7 +61,7 @@ class SocialAuthTest extends TestCase // Test login routes $resp = $this->get('/login'); $resp->assertElementExists('a#social-login-google[href$="/login/service/google"]'); - $resp = $this->followingRedirects()->get("/login/service/google"); + $resp = $this->followingRedirects()->get('/login/service/google'); $resp->assertSee('login-form'); // Test social callback @@ -70,18 +71,17 @@ class SocialAuthTest extends TestCase $resp = $this->get('/login'); $resp->assertElementExists('a#social-login-github[href$="/login/service/github"]'); - $resp = $this->followingRedirects()->get("/login/service/github"); + $resp = $this->followingRedirects()->get('/login/service/github'); $resp->assertSee('login-form'); - // Test social callback with matching social account DB::table('social_accounts')->insert([ - 'user_id' => $this->getAdmin()->id, - 'driver' => 'github', - 'driver_id' => 'logintest123' + 'user_id' => $this->getAdmin()->id, + 'driver' => 'github', + 'driver_id' => 'logintest123', ]); $resp = $this->followingRedirects()->get('/login/service/github/callback'); - $resp->assertDontSee("login-form"); + $resp->assertDontSee('login-form'); } public function test_social_account_detach() @@ -89,12 +89,12 @@ class SocialAuthTest extends TestCase $editor = $this->getEditor(); config([ 'GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', - 'APP_URL' => 'http://localhost' + 'APP_URL' => 'http://localhost', ]); $socialAccount = SocialAccount::query()->forceCreate([ - 'user_id' => $editor->id, - 'driver' => 'github', + 'user_id' => $editor->id, + 'driver' => 'github', 'driver_id' => 'logintest123', ]); @@ -113,7 +113,7 @@ class SocialAuthTest extends TestCase { config([ 'services.google.client_id' => 'abc123', 'services.google.client_secret' => '123abc', - 'APP_URL' => 'http://localhost' + 'APP_URL' => 'http://localhost', ]); $user = factory(User::class)->make(); @@ -151,7 +151,7 @@ class SocialAuthTest extends TestCase { config([ 'services.google.client_id' => 'abc123', 'services.google.client_secret' => '123abc', - 'APP_URL' => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true + 'APP_URL' => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true, ]); $user = factory(User::class)->make(); @@ -210,5 +210,4 @@ class SocialAuthTest extends TestCase $user = $user->whereEmail($user->email)->first(); $this->assertDatabaseHas('social_accounts', ['user_id' => $user->id]); } - }