X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c429cf78187e80deb63982a282a1c6889f30291a..refs/pull/3072/head:/tests/Auth/SocialAuthTest.php diff --git a/tests/Auth/SocialAuthTest.php b/tests/Auth/SocialAuthTest.php index 5818cbb74..90d7e37aa 100644 --- a/tests/Auth/SocialAuthTest.php +++ b/tests/Auth/SocialAuthTest.php @@ -2,9 +2,10 @@ 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; @@ -14,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']); @@ -82,6 +83,7 @@ class SocialAuthTest extends TestCase ]); $resp = $this->followingRedirects()->get('/login/service/github/callback'); $resp->assertDontSee('login-form'); + $this->assertActivityExists(ActivityType::AUTH_LOGIN, null, 'github; (' . $this->getAdmin()->id . ') ' . $this->getAdmin()->name); } public function test_social_account_detach() @@ -116,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); @@ -154,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); @@ -186,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' => 'nonameuser@example.com']); + $user = User::factory()->make(['email' => 'nonameuser@example.com']); $this->setSettings(['registration-enabled' => 'true']); config(['GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);