Fix pint issues

This commit is contained in:
Bubka 2024-05-29 11:53:41 +02:00
parent 7e52dcd7da
commit bc090e2d4d
6 changed files with 20 additions and 22 deletions

View File

@ -15,7 +15,7 @@ class CaseInsensitiveEmailExists implements ValidationRule
public function validate(string $attribute, mixed $value, Closure $fail) : void
{
$user = DB::table('users')
->whereRaw('email = ?' . ('sqlite' === config('database.default') ? ' COLLATE NOCASE' : ''), [strtolower($value)])
->whereRaw('email = ?' . (config('database.default') === 'sqlite' ? ' COLLATE NOCASE' : ''), [strtolower($value)])
->first();
if (! $user) {

View File

@ -77,7 +77,8 @@ public function migrate(mixed $migrationPayload) : Collection
/**
* Encode into uppercase Base32
*/
protected function toBase32(string $str) {
protected function toBase32(string $str)
{
return Base32::encodeUpper($str);
}
}

View File

@ -45,10 +45,10 @@ public function test_purgeLog_defaults_to_one_year()
$this->artisan('2fauth:purge-log');
$this->assertDatabaseHas('auth_logs', [
'id' => $sixMonthsOldLog->id
'id' => $sixMonthsOldLog->id,
]);
$this->assertDatabaseMissing('auth_logs', [
'id' => $oneYearOldLog->id
'id' => $oneYearOldLog->id,
]);
}
@ -64,7 +64,7 @@ public function test_purgeLog_deletes_records_older_than_retention_time()
$this->artisan('2fauth:purge-log');
$this->assertDatabaseMissing('auth_logs', [
'id' => $log->id
'id' => $log->id,
]);
}
@ -81,7 +81,7 @@ public function test_purgeLog_deletes_logout_only_records_older_than_retention_t
$this->artisan('2fauth:purge-log');
$this->assertDatabaseMissing('auth_logs', [
'id' => $log->id
'id' => $log->id,
]);
}
@ -97,7 +97,7 @@ public function test_purgeLog_does_not_delete_records_younger_than_retention_tim
$this->artisan('2fauth:purge-log');
$this->assertDatabaseHas('auth_logs', [
'id' => $log->id
'id' => $log->id,
]);
}
@ -114,10 +114,10 @@ public function test_purgeLog_with_invalid_config_defaults_to_one_year($config)
$this->artisan('2fauth:purge-log');
$this->assertDatabaseHas('auth_logs', [
'id' => $sixMonthsOldLog->id
'id' => $sixMonthsOldLog->id,
]);
$this->assertDatabaseMissing('auth_logs', [
'id' => $oneYearOldLog->id
'id' => $oneYearOldLog->id,
]);
}
@ -128,15 +128,14 @@ public static function provideInvalidConfig() : array
{
return [
'NULL' => [
null
null,
],
'EMPTY' => [
''
'',
],
'STRING' => [
'ljhkjh'
'ljhkjh',
],
];
}
}

View File

@ -16,7 +16,6 @@
use App\Services\Migrators\TwoFAuthMigrator;
use App\Services\SettingService;
use Illuminate\Support\Facades\Storage;
use Mockery;
use Mockery\MockInterface;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
@ -141,7 +140,6 @@ public function setUp() : void
/**
* Clean up the testing environment before the next test.
*
* @return void
*
* @throws \Mockery\Exception\InvalidCountException
*/