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

@@ -8,6 +8,7 @@ use Tests\TestCase;
class LogTest extends TestCase
{
public $user;
protected function setUp(): void
{
parent::setUp();
@@ -16,7 +17,7 @@ class LogTest extends TestCase
}
/** @test */
public function it_can_create_a_log_with_factory()
public function it_can_create_a_log_with_factory(): void
{
$log = Log::factory()->create();
@@ -26,7 +27,7 @@ class LogTest extends TestCase
}
/** @test */
public function it_has_correct_fillable_attributes()
public function it_has_correct_fillable_attributes(): void
{
$logData = [
'user_id' => $this->user->id,
@@ -34,7 +35,7 @@ class LogTest extends TestCase
'ip' => '192.168.1.1',
];
$log = Log::create($logData);
$log = Log::query()->create($logData);
foreach ($logData as $key => $value) {
$this->assertEquals($value, $log->$key);
@@ -42,7 +43,7 @@ class LogTest extends TestCase
}
/** @test */
public function it_belongs_to_a_user()
public function it_belongs_to_a_user(): void
{
$log = Log::factory()->create(['user_id' => $this->user->id]);
@@ -51,7 +52,7 @@ class LogTest extends TestCase
}
/** @test */
public function it_stores_ip_addresses_correctly()
public function it_stores_ip_addresses_correctly(): void
{
$ipAddresses = ['127.0.0.1', '192.168.1.100', '10.0.0.1'];
@@ -62,12 +63,12 @@ class LogTest extends TestCase
}
/** @test */
public function it_orders_logs_by_creation_date()
public function it_orders_logs_by_creation_date(): void
{
$oldLog = Log::factory()->create(['created_at' => now()->subHours(2)]);
$newLog = Log::factory()->create(['created_at' => now()]);
$logs = Log::orderBy('created_at', 'desc')->get();
$logs = Log::query()->latest()->get();
$this->assertEquals($newLog->id, $logs->first()->id);
$this->assertEquals($oldLog->id, $logs->last()->id);