refactor: auto refactor via rector

This commit is contained in:
idevakk
2025-09-29 01:08:34 +05:30
parent 744e0bb9bb
commit 21664b1a3e
26 changed files with 55 additions and 68 deletions

View File

@@ -5,13 +5,13 @@ use App\Models\User;
use Laravel\Fortify\Features;
use Livewire\Livewire;
test('login screen can be rendered', function () {
test('login screen can be rendered', function (): void {
$response = $this->get('/login');
$response->assertStatus(200);
});
test('users can authenticate using the login screen', function () {
test('users can authenticate using the login screen', function (): void {
$user = User::factory()->create();
$response = Livewire::test(Login::class)
@@ -26,7 +26,7 @@ test('users can authenticate using the login screen', function () {
$this->assertAuthenticated();
});
test('users can not authenticate with invalid password', function () {
test('users can not authenticate with invalid password', function (): void {
$user = User::factory()->create();
$response = Livewire::test(Login::class)
@@ -39,7 +39,7 @@ test('users can not authenticate with invalid password', function () {
$this->assertGuest();
});
test('users with two factor enabled are redirected to two factor challenge', function () {
test('users with two factor enabled are redirected to two factor challenge', function (): void {
if (! Features::canManageTwoFactorAuthentication()) {
$this->markTestSkipped('Two-factor authentication is not enabled.');
}
@@ -67,7 +67,7 @@ test('users with two factor enabled are redirected to two factor challenge', fun
$this->assertGuest();
});
test('users can logout', function () {
test('users can logout', function (): void {
$user = User::factory()->create();
$response = $this->actingAs($user)->post('/logout');

View File

@@ -5,7 +5,7 @@ use Illuminate\Auth\Events\Verified;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\URL;
test('email verification screen can be rendered', function () {
test('email verification screen can be rendered', function (): void {
$user = User::factory()->unverified()->create();
$response = $this->actingAs($user)->get('/verify-email');
@@ -13,7 +13,7 @@ test('email verification screen can be rendered', function () {
$response->assertStatus(200);
});
test('email can be verified', function () {
test('email can be verified', function (): void {
$user = User::factory()->unverified()->create();
Event::fake();
@@ -21,7 +21,7 @@ test('email can be verified', function () {
$verificationUrl = URL::temporarySignedRoute(
'verification.verify',
now()->addMinutes(60),
['id' => $user->id, 'hash' => sha1($user->email)]
['id' => $user->id, 'hash' => sha1((string) $user->email)]
);
$response = $this->actingAs($user)->get($verificationUrl);
@@ -32,7 +32,7 @@ test('email can be verified', function () {
$response->assertRedirect(route('dashboard', absolute: false).'?verified=1');
});
test('email is not verified with invalid hash', function () {
test('email is not verified with invalid hash', function (): void {
$user = User::factory()->unverified()->create();
$verificationUrl = URL::temporarySignedRoute(

View File

@@ -2,7 +2,7 @@
use App\Models\User;
test('confirm password screen can be rendered', function () {
test('confirm password screen can be rendered', function (): void {
$user = User::factory()->create();
$response = $this->actingAs($user)->get(route('password.confirm'));

View File

@@ -7,13 +7,13 @@ use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
use Illuminate\Support\Facades\Notification;
use Livewire\Livewire;
test('reset password link screen can be rendered', function () {
test('reset password link screen can be rendered', function (): void {
$response = $this->get('/forgot-password');
$response->assertStatus(200);
});
test('reset password link can be requested', function () {
test('reset password link can be requested', function (): void {
Notification::fake();
$user = User::factory()->create();
@@ -25,7 +25,7 @@ test('reset password link can be requested', function () {
Notification::assertSentTo($user, ResetPasswordNotification::class);
});
test('reset password screen can be rendered', function () {
test('reset password screen can be rendered', function (): void {
Notification::fake();
$user = User::factory()->create();
@@ -34,7 +34,7 @@ test('reset password screen can be rendered', function () {
->set('email', $user->email)
->call('sendPasswordResetLink');
Notification::assertSentTo($user, ResetPasswordNotification::class, function ($notification) {
Notification::assertSentTo($user, ResetPasswordNotification::class, function ($notification): true {
$response = $this->get('/reset-password/'.$notification->token);
$response->assertStatus(200);
@@ -43,7 +43,7 @@ test('reset password screen can be rendered', function () {
});
});
test('password can be reset with valid token', function () {
test('password can be reset with valid token', function (): void {
Notification::fake();
$user = User::factory()->create();
@@ -52,7 +52,7 @@ test('password can be reset with valid token', function () {
->set('email', $user->email)
->call('sendPasswordResetLink');
Notification::assertSentTo($user, ResetPasswordNotification::class, function ($notification) use ($user) {
Notification::assertSentTo($user, ResetPasswordNotification::class, function ($notification) use ($user): true {
$response = Livewire::test(ResetPassword::class, ['token' => $notification->token])
->set('email', $user->email)
->set('password', 'password')

View File

@@ -3,13 +3,13 @@
use App\Livewire\Auth\Register;
use Livewire\Livewire;
test('registration screen can be rendered', function () {
test('registration screen can be rendered', function (): void {
$response = $this->get('/register');
$response->assertStatus(200);
});
test('new users can register', function () {
test('new users can register', function (): void {
$response = Livewire::test(Register::class)
->set('name', 'Test User')
->set('email', 'test@example.com')

View File

@@ -4,7 +4,7 @@ use App\Models\User;
use Laravel\Fortify\Features;
use Livewire\Livewire;
test('two factor challenge redirects to login when not authenticated', function () {
test('two factor challenge redirects to login when not authenticated', function (): void {
if (! Features::canManageTwoFactorAuthentication()) {
$this->markTestSkipped('Two-factor authentication is not enabled.');
}
@@ -14,7 +14,7 @@ test('two factor challenge redirects to login when not authenticated', function
$response->assertRedirect(route('login'));
});
test('two factor challenge can be rendered', function () {
test('two factor challenge can be rendered', function (): void {
if (! Features::canManageTwoFactorAuthentication()) {
$this->markTestSkipped('Two-factor authentication is not enabled.');
}