1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Apply fixes from StyleCI

This commit is contained in:
Dan Brown
2021-06-26 15:23:15 +00:00
committed by StyleCI Bot
parent 3a402f6adc
commit 934a833818
349 changed files with 3655 additions and 2625 deletions

View 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]);
}
}