refactor: auto refactor via rector
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
test('guests are redirected to the login page', function () {
|
||||
test('guests are redirected to the login page', function (): void {
|
||||
$this->get('/dashboard')->assertRedirect('/login');
|
||||
});
|
||||
|
||||
test('authenticated users can visit the dashboard', function () {
|
||||
test('authenticated users can visit the dashboard', function (): void {
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
|
||||
$this->get('/dashboard')->assertStatus(200);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
test('returns a successful response', function () {
|
||||
test('returns a successful response', function (): void {
|
||||
$response = $this->get('/');
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
@@ -5,7 +5,7 @@ use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Livewire\Livewire;
|
||||
|
||||
test('password can be updated', function () {
|
||||
test('password can be updated', function (): void {
|
||||
$user = User::factory()->create([
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
@@ -23,7 +23,7 @@ test('password can be updated', function () {
|
||||
expect(Hash::check('new-password', $user->refresh()->password))->toBeTrue();
|
||||
});
|
||||
|
||||
test('correct password must be provided to update password', function () {
|
||||
test('correct password must be provided to update password', function (): void {
|
||||
$user = User::factory()->create([
|
||||
'password' => Hash::make('password'),
|
||||
]);
|
||||
|
||||
@@ -4,13 +4,13 @@ use App\Livewire\Settings\Profile;
|
||||
use App\Models\User;
|
||||
use Livewire\Livewire;
|
||||
|
||||
test('profile page is displayed', function () {
|
||||
test('profile page is displayed', function (): void {
|
||||
$this->actingAs($user = User::factory()->create());
|
||||
|
||||
$this->get('/settings/profile')->assertOk();
|
||||
});
|
||||
|
||||
test('profile information can be updated', function () {
|
||||
test('profile information can be updated', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user);
|
||||
@@ -29,7 +29,7 @@ test('profile information can be updated', function () {
|
||||
expect($user->email_verified_at)->toBeNull();
|
||||
});
|
||||
|
||||
test('email verification status is unchanged when email address is unchanged', function () {
|
||||
test('email verification status is unchanged when email address is unchanged', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user);
|
||||
@@ -44,7 +44,7 @@ test('email verification status is unchanged when email address is unchanged', f
|
||||
expect($user->refresh()->email_verified_at)->not->toBeNull();
|
||||
});
|
||||
|
||||
test('user can delete their account', function () {
|
||||
test('user can delete their account', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user);
|
||||
@@ -61,7 +61,7 @@ test('user can delete their account', function () {
|
||||
expect(auth()->check())->toBeFalse();
|
||||
});
|
||||
|
||||
test('correct password must be provided to delete account', function () {
|
||||
test('correct password must be provided to delete account', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user);
|
||||
|
||||
@@ -4,7 +4,7 @@ use App\Models\User;
|
||||
use Laravel\Fortify\Features;
|
||||
use Livewire\Livewire;
|
||||
|
||||
beforeEach(function () {
|
||||
beforeEach(function (): void {
|
||||
if (! Features::canManageTwoFactorAuthentication()) {
|
||||
$this->markTestSkipped('Two-factor authentication is not enabled.');
|
||||
}
|
||||
@@ -15,7 +15,7 @@ beforeEach(function () {
|
||||
]);
|
||||
});
|
||||
|
||||
test('two factor settings page can be rendered', function () {
|
||||
test('two factor settings page can be rendered', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
@@ -26,7 +26,7 @@ test('two factor settings page can be rendered', function () {
|
||||
->assertSee('Disabled');
|
||||
});
|
||||
|
||||
test('two factor settings page requires password confirmation when enabled', function () {
|
||||
test('two factor settings page requires password confirmation when enabled', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)
|
||||
@@ -35,7 +35,7 @@ test('two factor settings page requires password confirmation when enabled', fun
|
||||
$response->assertRedirect(route('password.confirm'));
|
||||
});
|
||||
|
||||
test('two factor settings page returns forbidden response when two factor is disabled', function () {
|
||||
test('two factor settings page returns forbidden response when two factor is disabled', function (): void {
|
||||
config(['fortify.features' => []]);
|
||||
|
||||
$user = User::factory()->create();
|
||||
@@ -47,7 +47,7 @@ test('two factor settings page returns forbidden response when two factor is dis
|
||||
$response->assertForbidden();
|
||||
});
|
||||
|
||||
test('two factor authentication disabled when confirmation abandoned between requests', function () {
|
||||
test('two factor authentication disabled when confirmation abandoned between requests', function (): void {
|
||||
$user = User::factory()->create();
|
||||
|
||||
$user->forceFill([
|
||||
|
||||
@@ -26,9 +26,7 @@ pest()->extend(Tests\TestCase::class)
|
||||
|
|
||||
*/
|
||||
|
||||
expect()->extend('toBeOne', function () {
|
||||
return $this->toBe(1);
|
||||
});
|
||||
expect()->extend('toBeOne', fn() => $this->toBe(1));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -41,7 +39,7 @@ expect()->extend('toBeOne', function () {
|
||||
|
|
||||
*/
|
||||
|
||||
function something()
|
||||
function something(): void
|
||||
{
|
||||
// ..
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
test('that true is true', function () {
|
||||
test('that true is true', function (): void {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
Reference in New Issue
Block a user