refactor: apply rector
Some checks are pending
tests / ci (push) Waiting to run

This commit is contained in:
Benjamin Nussbaum 2025-09-24 20:31:32 +02:00
parent c67a182cf2
commit b4b6286172
89 changed files with 672 additions and 666 deletions

View file

@ -10,7 +10,7 @@ use function Pest\Laravel\actingAs;
uses(RefreshDatabase::class);
test('configure view displays last_refreshed_at timestamp', function () {
test('configure view displays last_refreshed_at timestamp', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create([
'user_id' => $user->id,

View file

@ -8,7 +8,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('dashboard shows device image with correct rotation', function () {
test('dashboard shows device image with correct rotation', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create([
'user_id' => $user->id,
@ -28,7 +28,7 @@ test('dashboard shows device image with correct rotation', function () {
$response->assertSee('origin-center');
});
test('device configure page shows device image with correct rotation', function () {
test('device configure page shows device image with correct rotation', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create([
'user_id' => $user->id,
@ -48,7 +48,7 @@ test('device configure page shows device image with correct rotation', function
$response->assertSee('origin-center');
});
test('device with no rotation shows no transform style', function () {
test('device with no rotation shows no transform style', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create([
'user_id' => $user->id,
@ -67,7 +67,7 @@ test('device with no rotation shows no transform style', function () {
$response->assertSee('-rotate-[0deg]');
});
test('device with null rotation defaults to 0', function () {
test('device with null rotation defaults to 0', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create([
'user_id' => $user->id,

View file

@ -5,7 +5,7 @@ use Illuminate\Support\Carbon;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
test('device can be created with basic attributes', function () {
test('device can be created with basic attributes', function (): void {
$device = Device::factory()->create([
'name' => 'Test Device',
]);
@ -14,7 +14,7 @@ test('device can be created with basic attributes', function () {
->and($device->name)->toBe('Test Device');
});
test('battery percentage is calculated correctly', function () {
test('battery percentage is calculated correctly', function (): void {
$cases = [
['voltage' => 3.0, 'expected' => 0], // Min voltage
['voltage' => 4.2, 'expected' => 100], // Max voltage
@ -34,7 +34,7 @@ test('battery percentage is calculated correctly', function () {
}
});
test('wifi strength is determined correctly', function () {
test('wifi strength is determined correctly', function (): void {
$cases = [
['rssi' => 0, 'expected' => 0], // No signal
['rssi' => -90, 'expected' => 1], // Weak signal
@ -52,7 +52,7 @@ test('wifi strength is determined correctly', function () {
}
});
test('proxy cloud attribute is properly cast to boolean', function () {
test('proxy cloud attribute is properly cast to boolean', function (): void {
$device = Device::factory()->create([
'proxy_cloud' => true,
]);
@ -63,7 +63,7 @@ test('proxy cloud attribute is properly cast to boolean', function () {
expect($device->proxy_cloud)->toBeFalse();
});
test('last log request is properly cast to json', function () {
test('last log request is properly cast to json', function (): void {
$logData = ['status' => 'success', 'timestamp' => '2024-03-04 12:00:00'];
$device = Device::factory()->create([
@ -76,7 +76,7 @@ test('last log request is properly cast to json', function () {
->toHaveKey('timestamp');
});
test('getSleepModeEndsInSeconds returns correct value for overnight sleep window', function () {
test('getSleepModeEndsInSeconds returns correct value for overnight sleep window', function (): void {
// Set the current time to 12:13
Carbon::setTestNow(Carbon::create(2024, 1, 1, 12, 13, 0));

View file

@ -6,7 +6,7 @@ use Livewire\Volt\Volt;
uses(Illuminate\Foundation\Testing\RefreshDatabase::class);
test('device management page can be rendered', function () {
test('device management page can be rendered', function (): void {
$user = User::factory()->create();
$response = $this->actingAs($user)
@ -15,7 +15,7 @@ test('device management page can be rendered', function () {
$response->assertOk();
});
test('user can create a new device', function () {
test('user can create a new device', function (): void {
$user = User::factory()->create();
$this->actingAs($user);
@ -48,7 +48,7 @@ test('user can create a new device', function () {
expect($device->user_id)->toBe($user->id);
});
test('device creation requires required fields', function () {
test('device creation requires required fields', function (): void {
$user = User::factory()->create();
$this->actingAs($user);
@ -67,7 +67,7 @@ test('device creation requires required fields', function () {
]);
});
test('user can toggle proxy cloud for their device', function () {
test('user can toggle proxy cloud for their device', function (): void {
$user = User::factory()->create();
$this->actingAs($user);
$device = Device::factory()->create([
@ -88,7 +88,7 @@ test('user can toggle proxy cloud for their device', function () {
expect($device->fresh()->proxy_cloud)->toBeFalse();
});
test('user cannot toggle proxy cloud for other users devices', function () {
test('user cannot toggle proxy cloud for other users devices', function (): void {
$user = User::factory()->create();
$this->actingAs($user);