]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/SocialAuthTest.php
Move logFailedAccess into Activity
[bookstack] / tests / Auth / SocialAuthTest.php
index 5bfe0c222cb04e2dd35baacc35099b2ee31a5537..526c0e199a184cf7ee0a7f74c49fcea0bf42cbba 100644 (file)
@@ -6,7 +6,7 @@ class SocialAuthTest extends TestCase
     public function test_social_registration()
     {
         // http://docs.mockery.io/en/latest/reference/startup_methods.html
-        $user = factory(\BookStack\User::class)->make();
+        $user = factory(\BookStack\Auth\User::class)->make();
 
         $this->setSettings(['registration-enabled' => 'true']);
         config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
@@ -86,7 +86,7 @@ class SocialAuthTest extends TestCase
             'APP_URL' => 'http://localhost'
         ]);
 
-        $user = factory(\BookStack\User::class)->make();
+        $user = factory(\BookStack\Auth\User::class)->make();
         $mockSocialite = \Mockery::mock('Laravel\Socialite\Contracts\Factory');
         $this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
         $mockSocialDriver = \Mockery::mock('Laravel\Socialite\Contracts\Provider');
@@ -125,7 +125,7 @@ class SocialAuthTest extends TestCase
             'APP_URL' => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true
         ]);
 
-        $user = factory(\BookStack\User::class)->make();
+        $user = factory(\BookStack\Auth\User::class)->make();
         $mockSocialite = \Mockery::mock('Laravel\Socialite\Contracts\Factory');
         $this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
         $mockSocialDriver = \Mockery::mock('Laravel\Socialite\Contracts\Provider');
@@ -148,4 +148,12 @@ class SocialAuthTest extends TestCase
         $this->assertDatabaseHas('social_accounts', ['user_id' => $user->id]);
     }
 
+    public function test_google_select_account_option_changes_redirect_url()
+    {
+        config()->set('services.google.select_account', 'true');
+
+        $resp = $this->get('/login/service/google');
+        $this->assertStringContainsString('prompt=select_account', $resp->headers->get('Location'));
+    }
+
 }