Apply Laravel Pint fixes

This commit is contained in:
Bubka 2023-03-10 22:59:46 +01:00
parent 80723d94ba
commit dce3d16c37
37 changed files with 190 additions and 160 deletions

View File

@ -2,8 +2,8 @@
namespace App\Extensions;
use Illuminate\Auth\EloquentUserProvider;
use App\Models\WebAuthnAuthenticatable;
use Illuminate\Auth\EloquentUserProvider;
use Laragear\WebAuthn\Auth\WebAuthnUserProvider;
class WebauthnTwoFAuthUserProvider extends WebAuthnUserProvider
@ -13,7 +13,6 @@ class WebauthnTwoFAuthUserProvider extends WebAuthnUserProvider
*
* @param \Illuminate\Contracts\Auth\Authenticatable|\App\Models\WebAuthnAuthenticatable|\App\Models\User $user
* @param array $credentials
*
* @return bool
*/
public function validateCredentials($user, array $credentials) : bool

View File

@ -17,7 +17,6 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

View File

@ -5,7 +5,6 @@
use App\Models\Group;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Auth\Access\Response;
use Illuminate\Support\Facades\Log;
class GroupPolicy

View File

@ -4,7 +4,6 @@
use App\Extensions\RemoteUserProvider;
use App\Extensions\WebauthnCredentialBroker;
use App\Facades\Settings;
use App\Models\Group;
use App\Models\TwoFAccount;
use App\Policies\GroupPolicy;

View File

@ -2,8 +2,8 @@
namespace App\Providers;
use App\Events\GroupDeleting;
use App\Events\GroupDeleted;
use App\Events\GroupDeleting;
use App\Events\ScanForNewReleaseCalled;
use App\Events\TwoFAccountDeleted;
use App\Listeners\CleanIconStorage;

View File

@ -39,8 +39,9 @@ public static function assign($ids, User $user, Group $group = null) : void
$group->loadCount('twofaccounts');
Log::info(sprintf('Twofaccounts #%s assigned to group %s (ID #%s)', implode(',', $ids), var_export($group->name, true), $group->id));
} else {
Log::info('Cannot find a group to assign the TwoFAccounts to');
}
else Log::info('Cannot find a group to assign the TwoFAccounts to');
}
/**

View File

@ -16,17 +16,31 @@ class GroupControllerTest extends FeatureTestCase
/**
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
*/
protected $user, $anotherUser;
protected $user;
protected $anotherUser;
/**
* @var App\Models\Group
*/
protected $userGroupA, $userGroupB, $anotherUserGroupA, $anotherUserGroupB;
protected $userGroupA;
protected $userGroupB;
protected $anotherUserGroupA;
protected $anotherUserGroupB;
/**
* @var App\Models\TwoFAccount
*/
protected $twofaccountA, $twofaccountB, $twofaccountC, $twofaccountD;
protected $twofaccountA;
protected $twofaccountB;
protected $twofaccountC;
protected $twofaccountD;
private const NEW_GROUP_NAME = 'MyNewGroup';
@ -120,7 +134,6 @@ public function test_store_invalid_data_returns_validation_error()
->assertStatus(422);
}
/**
* @test
*/

View File

@ -17,9 +17,6 @@ class IconControllerTest extends FeatureTestCase
*/
protected $user;
/**
*
*/
public function setUp() : void
{
parent::setUp();

View File

@ -15,7 +15,9 @@ class QrCodeControllerTest extends FeatureTestCase
/**
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
*/
protected $user, $anotherUser;
protected $user;
protected $anotherUser;
/**
* @var App\Models\TwoFAccount

View File

@ -14,7 +14,9 @@ class SettingControllerTest extends FeatureTestCase
/**
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
*/
protected $user, $admin;
protected $user;
protected $admin;
private const SETTING_JSON_STRUCTURE = [
'key',

View File

@ -25,17 +25,31 @@ class TwoFAccountControllerTest extends FeatureTestCase
/**
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
*/
protected $user, $anotherUser;
protected $user;
protected $anotherUser;
/**
* @var App\Models\Group
*/
protected $userGroupA, $userGroupB, $anotherUserGroupA, $anotherUserGroupB;
protected $userGroupA;
protected $userGroupB;
protected $anotherUserGroupA;
protected $anotherUserGroupB;
/**
* @var App\Models\TwoFAccount
*/
protected $twofaccountA, $twofaccountB, $twofaccountC, $twofaccountD;
protected $twofaccountA;
protected $twofaccountB;
protected $twofaccountC;
protected $twofaccountD;
private const VALID_RESOURCE_STRUCTURE_WITHOUT_SECRET = [
'id',

View File

@ -17,6 +17,7 @@
class GroupStoreRequestTest extends FeatureTestCase
{
use WithoutMiddleware;
/**
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
*/

View File

@ -2,7 +2,6 @@
namespace Tests\Feature\Http\Auth;
use App\Facades\Settings;
use App\Models\User;
use Illuminate\Support\Carbon;
use Tests\FeatureTestCase;

View File

@ -138,29 +138,29 @@ public function test_delete_user_returns_success()
->assertNoContent();
$this->assertDatabaseMissing('users', [
'id' => $this->user->id
'id' => $this->user->id,
]);
$this->assertDatabaseHas('users', [
'id' => $admin->id
'id' => $admin->id,
]);
$this->assertDatabaseCount('users', 1);
$this->assertDatabaseMissing('twofaccounts', [
'user_id' => $this->user->id
'user_id' => $this->user->id,
]);
$this->assertDatabaseMissing('groups', [
'user_id' => $this->user->id
'user_id' => $this->user->id,
]);
$this->assertDatabaseMissing('webauthn_credentials', [
'authenticatable_id' => $this->user->id
'authenticatable_id' => $this->user->id,
]);
$this->assertDatabaseMissing('webauthn_recoveries', [
'email' => $this->user->email
'email' => $this->user->email,
]);
$this->assertDatabaseMissing('oauth_access_tokens', [
'user_id' => $this->user->id
'user_id' => $this->user->id,
]);
$this->assertDatabaseMissing('password_resets', [
'email' => $this->user->email
'email' => $this->user->email,
]);
}
@ -182,7 +182,7 @@ public function test_delete_user_in_demo_mode_returns_unauthorized()
]);
$this->assertDatabaseHas('users', [
'id' => $this->user->id
'id' => $this->user->id,
]);
}
@ -198,7 +198,7 @@ public function test_delete_user_passing_wrong_password_returns_bad_request()
->assertStatus(400);
$this->assertDatabaseHas('users', [
'id' => $this->user->id
'id' => $this->user->id,
]);
}
@ -222,7 +222,7 @@ public function test_delete_the_only_admin_returns_bad_request()
->assertStatus(400);
$this->assertDatabaseHas('users', [
'id' => $admin->id
'id' => $admin->id,
]);
}
}

View File

@ -51,7 +51,7 @@ public function test_infos_returns_only_base_collection()
'PHP version',
'Operating system',
'interface',
]
],
])
->assertJsonMissing([
'user_preferences',
@ -107,7 +107,7 @@ public function test_infos_returns_admin_settings_when_signed_in_as_admin()
'useEncryption',
'lastRadarScan',
'checkForUpdate',
]
],
]);
}
@ -123,7 +123,7 @@ public function test_infos_returns_proxy_collection_when_signed_in_behind_proxy(
'common' => [
'Auth proxy header for user',
'Auth proxy header for email',
]
],
]);
}

View File

@ -19,12 +19,18 @@ class TwoFAccountModelTest extends FeatureTestCase
/**
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
*/
protected $user, $anotherUser;
protected $user;
protected $anotherUser;
/**
* @var \App\Models\TwoFAccount
*/
protected $customTotpTwofaccount, $customHotpTwofaccount, $customSteamTotpTwofaccount;
protected $customTotpTwofaccount;
protected $customHotpTwofaccount;
protected $customSteamTotpTwofaccount;
/**
* Helpers $helpers;

View File

@ -24,12 +24,16 @@ class TwoFAccountServiceTest extends FeatureTestCase
/**
* @var \App\Models\TwoFAccount
*/
protected $customTotpTwofaccount, $customHotpTwofaccount;
protected $customTotpTwofaccount;
protected $customHotpTwofaccount;
/**
* @var \App\Models\Group
*/
protected $userGroupA, $userGroupB;
protected $userGroupA;
protected $userGroupB;
/**
* @test

View File

@ -27,9 +27,6 @@ class GroupControllerTest extends TestCase
*/
protected $user;
/**
*
*/
public function setUp() : void
{
parent::setUp();

View File

@ -4,7 +4,6 @@
use App\Events\GroupDeleted;
use App\Events\GroupDeleting;
use App\Models\User;
use App\Models\Group;
use App\Models\TwoFAccount;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -29,7 +28,7 @@ public function test_model_configuration()
['id' => 'int', 'twofaccounts_count' => 'integer'],
[
'deleting' => GroupDeleting::class,
'deleted' => GroupDeleted::class
'deleted' => GroupDeleted::class,
]
);
}

View File

@ -5,7 +5,6 @@
use App\Events\GroupDeleted;
use App\Listeners\ResetUsersPreference;
use Illuminate\Support\Facades\Event;
use Mockery\MockInterface;
use Tests\TestCase;
/**

View File

@ -7,7 +7,6 @@
use App\Exceptions\UnsupportedMigrationException;
use App\Factories\MigratorFactory;
use App\Models\TwoFAccount;
use App\Models\User;
use App\Services\LogoService;
use App\Services\Migrators\AegisMigrator;
use App\Services\Migrators\GoogleAuthMigrator;
@ -59,7 +58,9 @@ class MigratorTest extends TestCase
/**
* App\Models\TwoFAccount $GAuthTotpBisTwofaccount
*/
protected $GAuthTotpBisTwofaccount, $fakeTwofaccount;
protected $GAuthTotpBisTwofaccount;
protected $fakeTwofaccount;
public function setUp() : void
{
@ -77,7 +78,6 @@ public function setUp() : void
]);
});
$this->totpTwofaccount = new TwoFAccount;
$this->totpTwofaccount->legacy_uri = OtpTestData::TOTP_FULL_CUSTOM_URI_NO_IMG;
$this->totpTwofaccount->service = OtpTestData::SERVICE;