chore: code refactor via rector

This commit is contained in:
idevakk
2025-11-14 02:01:01 -08:00
parent 90ab79b3a2
commit ae795880ed
148 changed files with 1520 additions and 1486 deletions

View File

@@ -4,7 +4,6 @@ namespace Tests\Feature\Livewire\Auth;
use App\Livewire\Auth\Login;
use App\Models\User;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Session;
@@ -13,6 +12,7 @@ use Tests\TestCase;
class LoginTest extends TestCase
{
public $user;
protected function setUp(): void
{
parent::setUp();
@@ -24,7 +24,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_renders_the_login_component()
public function it_renders_the_login_component(): void
{
$component = Livewire::test(Login::class);
@@ -34,7 +34,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_validates_required_email_field()
public function it_validates_required_email_field(): void
{
$component = Livewire::test(Login::class);
@@ -44,7 +44,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_validates_email_format()
public function it_validates_email_format(): void
{
$component = Livewire::test(Login::class);
@@ -54,7 +54,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_validates_required_password_field()
public function it_validates_required_password_field(): void
{
$component = Livewire::test(Login::class);
@@ -64,7 +64,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_authenticates_user_with_valid_credentials()
public function it_authenticates_user_with_valid_credentials(): void
{
$component = Livewire::test(Login::class);
@@ -77,7 +77,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_fails_authentication_with_invalid_credentials()
public function it_fails_authentication_with_invalid_credentials(): void
{
$component = Livewire::test(Login::class);
@@ -88,7 +88,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_handles_rate_limiting()
public function it_handles_rate_limiting(): void
{
// Clear any existing rate limit attempts
RateLimiter::clear('login:'.request()->ip());
@@ -110,7 +110,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_redirects_authenticated_users_away()
public function it_redirects_authenticated_users_away(): void
{
$this->actingAs($this->user);
@@ -121,7 +121,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_handles_lockout_event()
public function it_handles_lockout_event(): void
{
// Clear any existing rate limit attempts
RateLimiter::clear('login:'.request()->ip());
@@ -143,7 +143,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_clears_session_after_successful_login()
public function it_clears_session_after_successful_login(): void
{
Session::put('old_url', '/some-page');
@@ -159,7 +159,7 @@ class LoginTest extends TestCase
}
/** @test */
public function it_remember_me_functionality_works()
public function it_remember_me_functionality_works(): void
{
$component = Livewire::test(Login::class);

View File

@@ -14,7 +14,7 @@ use Tests\TestCase;
class RegisterTest extends TestCase
{
/** @test */
public function it_renders_the_register_component()
public function it_renders_the_register_component(): void
{
$component = Livewire::test(Register::class);
@@ -25,7 +25,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_validates_required_name_field()
public function it_validates_required_name_field(): void
{
$component = Livewire::test(Register::class);
@@ -38,7 +38,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_validates_required_email_field()
public function it_validates_required_email_field(): void
{
$component = Livewire::test(Register::class);
@@ -51,7 +51,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_validates_email_format()
public function it_validates_email_format(): void
{
$component = Livewire::test(Register::class);
@@ -65,7 +65,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_validates_required_password_field()
public function it_validates_required_password_field(): void
{
$component = Livewire::test(Register::class);
@@ -78,7 +78,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_validates_password_confirmation()
public function it_validates_password_confirmation(): void
{
$component = Livewire::test(Register::class);
@@ -92,7 +92,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_creates_user_with_valid_data()
public function it_creates_user_with_valid_data(): void
{
Event::fake();
@@ -110,12 +110,12 @@ class RegisterTest extends TestCase
'email' => 'test@gmail.com',
]);
$this->assertAuthenticatedAs(User::where('email', 'test@gmail.com')->first());
$this->assertAuthenticatedAs(User::query()->where('email', 'test@gmail.com')->first());
Event::assertDispatched(Registered::class);
}
/** @test */
public function it_hashes_password_before_storing()
public function it_hashes_password_before_storing(): void
{
$component = Livewire::test(Register::class);
@@ -126,12 +126,12 @@ class RegisterTest extends TestCase
->set('password_confirmation', 'Password123!')
->call('register');
$user = User::where('email', 'test@gmail.com')->first();
$user = User::query()->where('email', 'test@gmail.com')->first();
$this->assertTrue(Hash::check('Password123!', $user->password));
}
/** @test */
public function it_prevents_duplicate_email_registration()
public function it_prevents_duplicate_email_registration(): void
{
// Create existing user
User::factory()->create(['email' => 'test@gmail.com']);
@@ -148,7 +148,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_redirects_after_successful_registration()
public function it_redirects_after_successful_registration(): void
{
$component = Livewire::test(Register::class);
@@ -163,7 +163,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_logs_in_user_after_registration()
public function it_logs_in_user_after_registration(): void
{
$component = Livewire::test(Register::class);
@@ -179,7 +179,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_handles_maximum_name_length()
public function it_handles_maximum_name_length(): void
{
$component = Livewire::test(Register::class);
@@ -193,7 +193,7 @@ class RegisterTest extends TestCase
}
/** @test */
public function it_handles_password_validation()
public function it_handles_password_validation(): void
{
$component = Livewire::test(Register::class);