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

@ -7,7 +7,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('example recipes seeder command calls seeder with correct user id', function () {
test('example recipes seeder command calls seeder with correct user id', function (): void {
$seeder = Mockery::mock(ExampleRecipesSeeder::class);
$seeder->shouldReceive('run')
->once()
@ -19,14 +19,14 @@ test('example recipes seeder command calls seeder with correct user id', functio
->assertExitCode(0);
});
test('example recipes seeder command has correct signature', function () {
test('example recipes seeder command has correct signature', function (): void {
$command = $this->app->make(App\Console\Commands\ExampleRecipesSeederCommand::class);
expect($command->getName())->toBe('recipes:seed');
expect($command->getDescription())->toBe('Seed example recipes');
});
test('example recipes seeder command prompts for missing input', function () {
test('example recipes seeder command prompts for missing input', function (): void {
$seeder = Mockery::mock(ExampleRecipesSeeder::class);
$seeder->shouldReceive('run')
->once()

View file

@ -3,7 +3,7 @@
use App\Jobs\FetchProxyCloudResponses;
use Illuminate\Support\Facades\Bus;
test('it dispatches fetch proxy cloud responses job', function () {
test('it dispatches fetch proxy cloud responses job', function (): void {
// Prevent the job from actually running
Bus::fake();

View file

@ -6,24 +6,24 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
test('firmware check command has correct signature', function () {
test('firmware check command has correct signature', function (): void {
$command = $this->app->make(App\Console\Commands\FirmwareCheckCommand::class);
expect($command->getName())->toBe('trmnl:firmware:check');
expect($command->getDescription())->toBe('Checks for the latest firmware and downloads it if flag --download is passed.');
});
test('firmware check command runs without errors', function () {
test('firmware check command runs without errors', function (): void {
$this->artisan('trmnl:firmware:check')
->assertExitCode(0);
});
test('firmware check command runs with download flag', function () {
test('firmware check command runs with download flag', function (): void {
$this->artisan('trmnl:firmware:check', ['--download' => true])
->assertExitCode(0);
});
test('firmware check command can run successfully', function () {
test('firmware check command can run successfully', function (): void {
$this->artisan('trmnl:firmware:check')
->assertExitCode(0);
});

View file

@ -6,12 +6,12 @@ use App\Models\Device;
use App\Models\Firmware;
use App\Models\User;
test('firmware update command has correct signature', function () {
test('firmware update command has correct signature', function (): void {
$this->artisan('trmnl:firmware:update --help')
->assertExitCode(0);
});
test('firmware update command can be called', function () {
test('firmware update command can be called', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$firmware = Firmware::factory()->create(['version_tag' => '1.0.0']);
@ -26,7 +26,7 @@ test('firmware update command can be called', function () {
expect($device->update_firmware_id)->toBe($firmware->id);
});
test('firmware update command updates all devices when all is selected', function () {
test('firmware update command updates all devices when all is selected', function (): void {
$user = User::factory()->create();
$device1 = Device::factory()->create(['user_id' => $user->id]);
$device2 = Device::factory()->create(['user_id' => $user->id]);
@ -44,7 +44,7 @@ test('firmware update command updates all devices when all is selected', functio
expect($device2->update_firmware_id)->toBe($firmware->id);
});
test('firmware update command aborts when no devices selected', function () {
test('firmware update command aborts when no devices selected', function (): void {
$firmware = Firmware::factory()->create(['version_tag' => '1.0.0']);
$this->artisan('trmnl:firmware:update')
@ -55,7 +55,7 @@ test('firmware update command aborts when no devices selected', function () {
->assertExitCode(0);
});
test('firmware update command calls firmware check when check is selected', function () {
test('firmware update command calls firmware check when check is selected', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$firmware = Firmware::factory()->create(['version_tag' => '1.0.0']);
@ -70,7 +70,7 @@ test('firmware update command calls firmware check when check is selected', func
expect($device->update_firmware_id)->toBe($firmware->id);
});
test('firmware update command calls firmware check with download when download is selected', function () {
test('firmware update command calls firmware check with download when download is selected', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$firmware = Firmware::factory()->create(['version_tag' => '1.0.0']);

View file

@ -8,12 +8,12 @@ use App\Models\PlaylistItem;
use App\Models\Plugin;
use App\Models\User;
test('mashup create command has correct signature', function () {
test('mashup create command has correct signature', function (): void {
$this->artisan('mashup:create --help')
->assertExitCode(0);
});
test('mashup create command creates mashup successfully', function () {
test('mashup create command creates mashup successfully', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
@ -40,13 +40,13 @@ test('mashup create command creates mashup successfully', function () {
expect($playlistItem->getMashupPluginIds())->toContain($plugin1->id, $plugin2->id);
});
test('mashup create command exits when no devices found', function () {
test('mashup create command exits when no devices found', function (): void {
$this->artisan('mashup:create')
->expectsOutput('No devices found. Please create a device first.')
->assertExitCode(1);
});
test('mashup create command exits when no playlists found for device', function () {
test('mashup create command exits when no playlists found for device', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
@ -56,7 +56,7 @@ test('mashup create command exits when no playlists found for device', function
->assertExitCode(1);
});
test('mashup create command exits when no plugins found', function () {
test('mashup create command exits when no plugins found', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
@ -70,7 +70,7 @@ test('mashup create command exits when no plugins found', function () {
->assertExitCode(1);
});
test('mashup create command validates mashup name length', function () {
test('mashup create command validates mashup name length', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
@ -86,7 +86,7 @@ test('mashup create command validates mashup name length', function () {
->assertExitCode(1);
});
test('mashup create command validates mashup name maximum length', function () {
test('mashup create command validates mashup name maximum length', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
@ -104,7 +104,7 @@ test('mashup create command validates mashup name maximum length', function () {
->assertExitCode(1);
});
test('mashup create command uses default name when provided', function () {
test('mashup create command uses default name when provided', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);
@ -128,7 +128,7 @@ test('mashup create command uses default name when provided', function () {
expect($playlistItem)->not->toBeNull();
});
test('mashup create command handles 1x1 layout with single plugin', function () {
test('mashup create command handles 1x1 layout with single plugin', function (): void {
$user = User::factory()->create();
$device = Device::factory()->create(['user_id' => $user->id]);
$playlist = Playlist::factory()->create(['device_id' => $device->id]);

View file

@ -4,12 +4,12 @@ declare(strict_types=1);
use function Pest\Laravel\mock;
test('oidc test command has correct signature', function () {
test('oidc test command has correct signature', function (): void {
$this->artisan('oidc:test --help')
->assertExitCode(0);
});
test('oidc test command runs successfully with disabled oidc', function () {
test('oidc test command runs successfully with disabled oidc', function (): void {
config([
'app.url' => 'http://localhost',
'services.oidc.enabled' => false,
@ -40,7 +40,7 @@ test('oidc test command runs successfully with disabled oidc', function () {
->assertExitCode(0);
});
test('oidc test command runs successfully with enabled oidc but missing config', function () {
test('oidc test command runs successfully with enabled oidc but missing config', function (): void {
config([
'app.url' => 'http://localhost',
'services.oidc.enabled' => true,
@ -70,7 +70,7 @@ test('oidc test command runs successfully with enabled oidc but missing config',
->assertExitCode(0);
});
test('oidc test command runs successfully with partial config', function () {
test('oidc test command runs successfully with partial config', function (): void {
config([
'services.oidc.enabled' => true,
'services.oidc.endpoint' => 'https://example.com',
@ -95,9 +95,9 @@ test('oidc test command runs successfully with partial config', function () {
->assertExitCode(0);
});
test('oidc test command runs successfully with full config but disabled', function () {
test('oidc test command runs successfully with full config but disabled', function (): void {
// Mock the HTTP client to return fake OIDC configuration
mock(GuzzleHttp\Client::class, function ($mock) {
mock(GuzzleHttp\Client::class, function ($mock): void {
$mock->shouldReceive('get')
->with('https://example.com/.well-known/openid-configuration')
->andReturn(new GuzzleHttp\Psr7\Response(200, [], json_encode([
@ -129,9 +129,9 @@ test('oidc test command runs successfully with full config but disabled', functi
->assertExitCode(0);
});
test('oidc test command runs successfully with full config and enabled', function () {
test('oidc test command runs successfully with full config and enabled', function (): void {
// Mock the HTTP client to return fake OIDC configuration
mock(GuzzleHttp\Client::class, function ($mock) {
mock(GuzzleHttp\Client::class, function ($mock): void {
$mock->shouldReceive('get')
->with('https://example.com/.well-known/openid-configuration')
->andReturn(new GuzzleHttp\Psr7\Response(200, [], json_encode([
@ -164,9 +164,9 @@ test('oidc test command runs successfully with full config and enabled', functio
->assertExitCode(0);
});
test('oidc test command handles empty scopes', function () {
test('oidc test command handles empty scopes', function (): void {
// Mock the HTTP client to return fake OIDC configuration
mock(GuzzleHttp\Client::class, function ($mock) {
mock(GuzzleHttp\Client::class, function ($mock): void {
$mock->shouldReceive('get')
->with('https://example.com/.well-known/openid-configuration')
->andReturn(new GuzzleHttp\Psr7\Response(200, [], json_encode([

View file

@ -3,7 +3,7 @@
use App\Jobs\GenerateScreenJob;
use Illuminate\Support\Facades\Bus;
test('it generates screen with default parameters', function () {
test('it generates screen with default parameters', function (): void {
Bus::fake();
$this->artisan('trmnl:screen:generate')