]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/SocialAuthTest.php
Fixes for CodeStyle vol.2
[bookstack] / tests / Auth / SocialAuthTest.php
index 60de8fbcbbcc07165081dbbfe7e6f8bd98e26740..5818cbb742bbe57c68292fef25ed59f0deacc473 100644 (file)
@@ -1,4 +1,6 @@
-<?php namespace Tests\Auth;
+<?php
+
+namespace Tests\Auth;
 
 use BookStack\Auth\SocialAccount;
 use BookStack\Auth\User;
@@ -10,7 +12,6 @@ use Tests\TestCase;
 
 class SocialAuthTest extends TestCase
 {
-
     public function test_social_registration()
     {
         $user = factory(User::class)->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]);
     }
-
 }