lint fix
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Successful in 1m52s Details
Tests & Lint & Deploy to Railway / deploy (push) Successful in 38s Details

This commit is contained in:
aslan 2024-06-19 16:40:34 +03:00
parent ad73cbade1
commit 502bc49042
19 changed files with 61 additions and 56 deletions

View File

@ -24,10 +24,12 @@ class ConfirmablePasswordController extends Controller
*/ */
public function store(Request $request): RedirectResponse public function store(Request $request): RedirectResponse
{ {
if (! Auth::guard('web')->validate([ if (
! Auth::guard('web')->validate([
'email' => $request->user()->email, 'email' => $request->user()->email,
'password' => $request->password, 'password' => $request->password,
])) { ])
) {
throw ValidationException::withMessages([ throw ValidationException::withMessages([
'password' => __('auth.password'), 'password' => __('auth.password'),
]); ]);

View File

@ -31,7 +31,7 @@ class RegisteredUserController extends Controller
{ {
$request->validate([ $request->validate([
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class], 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:' . User::class],
'password' => ['required', 'confirmed', Rules\Password::defaults()], 'password' => ['required', 'confirmed', Rules\Password::defaults()],
]); ]);

View File

@ -15,13 +15,13 @@ class VerifyEmailController extends Controller
public function __invoke(EmailVerificationRequest $request): RedirectResponse public function __invoke(EmailVerificationRequest $request): RedirectResponse
{ {
if ($request->user()->hasVerifiedEmail()) { if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
} }
if ($request->user()->markEmailAsVerified()) { if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user())); event(new Verified($request->user()));
} }
return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
} }
} }

View File

@ -80,6 +80,6 @@ class LoginRequest extends FormRequest
*/ */
public function throttleKey(): string public function throttleKey(): string
{ {
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip()); return Str::transliterate(Str::lower($this->string('email')) . '|' . $this->ip());
} }
} }

View File

@ -17,7 +17,13 @@ class ProfileUpdateRequest extends FormRequest
{ {
return [ return [
'name' => ['required', 'string', 'max:255'], 'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)], 'email' => [
'required',
'string',
'lowercase',
'email',
'max:255',
Rule::unique(User::class)->ignore($this->user()->id)],
]; ];
} }
} }

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class () extends Migration {
{
/** /**
* Run the migrations. * Run the migrations.
*/ */

View File

@ -17,4 +17,4 @@ Route::middleware('auth')->group(function () {
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
}); });
require __DIR__.'/auth.php'; require __DIR__ . '/auth.php';

View File

@ -10,14 +10,14 @@ class AuthenticationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_login_screen_can_be_rendered(): void public function testLoginScreenCanBeRendered(): void
{ {
$response = $this->get('/login'); $response = $this->get('/login');
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_users_can_authenticate_using_the_login_screen(): void public function testUsersCanAuthenticateUsingTheLoginScreen(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -30,7 +30,7 @@ class AuthenticationTest extends TestCase
$response->assertRedirect(route('dashboard', absolute: false)); $response->assertRedirect(route('dashboard', absolute: false));
} }
public function test_users_can_not_authenticate_with_invalid_password(): void public function testUsersCanNotAuthenticateWithInvalidPassword(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -42,7 +42,7 @@ class AuthenticationTest extends TestCase
$this->assertGuest(); $this->assertGuest();
} }
public function test_users_can_logout(): void public function testUsersCanLogout(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();

View File

@ -13,7 +13,7 @@ class EmailVerificationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_email_verification_screen_can_be_rendered(): void public function testEmailVerificationScreenCanBeRendered(): void
{ {
$user = User::factory()->unverified()->create(); $user = User::factory()->unverified()->create();
@ -22,7 +22,7 @@ class EmailVerificationTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_email_can_be_verified(): void public function testEmailCanBeVerified(): void
{ {
$user = User::factory()->unverified()->create(); $user = User::factory()->unverified()->create();
@ -38,10 +38,10 @@ class EmailVerificationTest extends TestCase
Event::assertDispatched(Verified::class); Event::assertDispatched(Verified::class);
$this->assertTrue($user->fresh()->hasVerifiedEmail()); $this->assertTrue($user->fresh()->hasVerifiedEmail());
$response->assertRedirect(route('dashboard', absolute: false).'?verified=1'); $response->assertRedirect(route('dashboard', absolute: false) . '?verified=1');
} }
public function test_email_is_not_verified_with_invalid_hash(): void public function testEmailIsNotVerifiedWithInvalidHash(): void
{ {
$user = User::factory()->unverified()->create(); $user = User::factory()->unverified()->create();

View File

@ -10,7 +10,7 @@ class PasswordConfirmationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_confirm_password_screen_can_be_rendered(): void public function testConfirmPasswordScreenCanBeRendered(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -19,7 +19,7 @@ class PasswordConfirmationTest extends TestCase
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_password_can_be_confirmed(): void public function testPasswordCanBeConfirmed(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -31,7 +31,7 @@ class PasswordConfirmationTest extends TestCase
$response->assertSessionHasNoErrors(); $response->assertSessionHasNoErrors();
} }
public function test_password_is_not_confirmed_with_invalid_password(): void public function testPasswordIsNotConfirmedWithInvalidPassword(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();

View File

@ -12,14 +12,14 @@ class PasswordResetTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_reset_password_link_screen_can_be_rendered(): void public function testResetPasswordLinkScreenCanBeRendered(): void
{ {
$response = $this->get('/forgot-password'); $response = $this->get('/forgot-password');
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_reset_password_link_can_be_requested(): void public function testResetPasswordLinkCanBeRequested(): void
{ {
Notification::fake(); Notification::fake();
@ -30,7 +30,7 @@ class PasswordResetTest extends TestCase
Notification::assertSentTo($user, ResetPassword::class); Notification::assertSentTo($user, ResetPassword::class);
} }
public function test_reset_password_screen_can_be_rendered(): void public function testResetPasswordScreenCanBeRendered(): void
{ {
Notification::fake(); Notification::fake();
@ -39,7 +39,7 @@ class PasswordResetTest extends TestCase
$this->post('/forgot-password', ['email' => $user->email]); $this->post('/forgot-password', ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) { Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
$response = $this->get('/reset-password/'.$notification->token); $response = $this->get('/reset-password/' . $notification->token);
$response->assertStatus(200); $response->assertStatus(200);
@ -47,7 +47,7 @@ class PasswordResetTest extends TestCase
}); });
} }
public function test_password_can_be_reset_with_valid_token(): void public function testPasswordCanBeResetWithValidToken(): void
{ {
Notification::fake(); Notification::fake();

View File

@ -11,7 +11,7 @@ class PasswordUpdateTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_password_can_be_updated(): void public function testPasswordCanBeUpdated(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -31,7 +31,7 @@ class PasswordUpdateTest extends TestCase
$this->assertTrue(Hash::check('new-password', $user->refresh()->password)); $this->assertTrue(Hash::check('new-password', $user->refresh()->password));
} }
public function test_correct_password_must_be_provided_to_update_password(): void public function testCorrectPasswordMustBeProvidedToUpdatePassword(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();

View File

@ -9,14 +9,14 @@ class RegistrationTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_registration_screen_can_be_rendered(): void public function testRegistrationScreenCanBeRendered(): void
{ {
$response = $this->get('/register'); $response = $this->get('/register');
$response->assertStatus(200); $response->assertStatus(200);
} }
public function test_new_users_can_register(): void public function testNewUsersCanRegister(): void
{ {
$response = $this->post('/register', [ $response = $this->post('/register', [
'name' => 'Test User', 'name' => 'Test User',

View File

@ -10,7 +10,7 @@ class ProfileTest extends TestCase
{ {
use RefreshDatabase; use RefreshDatabase;
public function test_profile_page_is_displayed(): void public function testProfilePageIsDisplayed(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -21,7 +21,7 @@ class ProfileTest extends TestCase
$response->assertOk(); $response->assertOk();
} }
public function test_profile_information_can_be_updated(): void public function testProfileInformationCanBeUpdated(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -43,7 +43,7 @@ class ProfileTest extends TestCase
$this->assertNull($user->email_verified_at); $this->assertNull($user->email_verified_at);
} }
public function test_email_verification_status_is_unchanged_when_the_email_address_is_unchanged(): void public function testEmailVerificationStatusIsUnchangedWhenTheEmailAddressIsUnchanged(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -61,7 +61,7 @@ class ProfileTest extends TestCase
$this->assertNotNull($user->refresh()->email_verified_at); $this->assertNotNull($user->refresh()->email_verified_at);
} }
public function test_user_can_delete_their_account(): void public function testUserCanDeleteTheirAccount(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();
@ -79,7 +79,7 @@ class ProfileTest extends TestCase
$this->assertNull($user->fresh()); $this->assertNull($user->fresh());
} }
public function test_correct_password_must_be_provided_to_delete_account(): void public function testCorrectPasswordMustBeProvidedToDeleteAccount(): void
{ {
$user = User::factory()->create(); $user = User::factory()->create();