]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/SocialAuthTest.php
Added language list favourites sorting, updated styles
[bookstack] / tests / Auth / SocialAuthTest.php
index 44b9e4ce1ce94425654887ae404b80d8e9ec2644..67da771a5176f439200e95a9fbd27d257f79539f 100644 (file)
@@ -5,7 +5,7 @@ namespace Tests\Auth;
 use BookStack\Actions\ActivityType;
 use BookStack\Auth\SocialAccount;
 use BookStack\Auth\User;
-use DB;
+use Illuminate\Support\Facades\DB;
 use Laravel\Socialite\Contracts\Factory;
 use Laravel\Socialite\Contracts\Provider;
 use Mockery;
@@ -15,7 +15,7 @@ class SocialAuthTest extends TestCase
 {
     public function test_social_registration()
     {
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
 
         $this->setSettings(['registration-enabled' => 'true']);
         config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
@@ -61,7 +61,7 @@ class SocialAuthTest extends TestCase
 
         // Test login routes
         $resp = $this->get('/login');
-        $resp->assertElementExists('a#social-login-google[href$="/login/service/google"]');
+        $this->withHtml($resp)->assertElementExists('a#social-login-google[href$="/login/service/google"]');
         $resp = $this->followingRedirects()->get('/login/service/google');
         $resp->assertSee('login-form');
 
@@ -71,7 +71,7 @@ class SocialAuthTest extends TestCase
         $resp->assertSee(trans('errors.social_account_not_used', ['socialAccount' => 'Google']));
 
         $resp = $this->get('/login');
-        $resp->assertElementExists('a#social-login-github[href$="/login/service/github"]');
+        $this->withHtml($resp)->assertElementExists('a#social-login-github[href$="/login/service/github"]');
         $resp = $this->followingRedirects()->get('/login/service/github');
         $resp->assertSee('login-form');
 
@@ -101,7 +101,7 @@ class SocialAuthTest extends TestCase
         ]);
 
         $resp = $this->actingAs($editor)->get($editor->getEditUrl());
-        $resp->assertElementContains('form[action$="/login/service/github/detach"]', 'Disconnect Account');
+        $this->withHtml($resp)->assertElementContains('form[action$="/login/service/github/detach"]', 'Disconnect Account');
 
         $resp = $this->post('/login/service/github/detach');
         $resp->assertRedirect($editor->getEditUrl());
@@ -118,7 +118,7 @@ class SocialAuthTest extends TestCase
             'APP_URL'                   => 'http://localhost',
         ]);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $mockSocialite = $this->mock(Factory::class);
         $mockSocialDriver = Mockery::mock(Provider::class);
         $mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
@@ -156,7 +156,7 @@ class SocialAuthTest extends TestCase
             'APP_URL'                   => 'http://localhost', 'services.google.auto_register' => true, 'services.google.auto_confirm' => true,
         ]);
 
-        $user = factory(User::class)->make();
+        $user = User::factory()->make();
         $mockSocialite = $this->mock(Factory::class);
         $mockSocialDriver = Mockery::mock(Provider::class);
         $mockSocialUser = Mockery::mock(\Laravel\Socialite\Contracts\User::class);
@@ -188,7 +188,7 @@ class SocialAuthTest extends TestCase
 
     public function test_social_registration_with_no_name_uses_email_as_name()
     {
-        $user = factory(User::class)->make(['email' => '[email protected]']);
+        $user = User::factory()->make(['email' => '[email protected]']);
 
         $this->setSettings(['registration-enabled' => 'true']);
         config(['GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);