chore: update to pestphp v4
Some checks failed
tests / ci (push) Has been cancelled

This commit is contained in:
Benjamin Nussbaum 2025-08-22 20:29:03 +02:00
parent 414ca47cbf
commit f1d5c196e8
8 changed files with 544 additions and 618 deletions

View file

@ -207,7 +207,7 @@ avatar, badge, brand, breadcrumbs, button, callout, checkbox, dropdown, field, h
## Livewire Core ## Livewire Core
- Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests. - Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests.
- Use the `php artisan make:livewire [Posts\\CreatePost]` artisan command to create new components - Use the `php artisan make:livewire [Posts\CreatePost]` artisan command to create new components
- State should live on the server, with the UI reflecting it. - State should live on the server, with the UI reflecting it.
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions. - All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.

View file

@ -35,10 +35,9 @@
"laravel/sail": "^1.41", "laravel/sail": "^1.41",
"mockery/mockery": "^1.6", "mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6", "nunomaduro/collision": "^8.6",
"pestphp/pest": "^3.7", "pestphp/pest": "^4.0",
"pestphp/pest-plugin-drift": "^3.0", "pestphp/pest-plugin-drift": "^4.0",
"pestphp/pest-plugin-laravel": "^3.1", "pestphp/pest-plugin-laravel": "^4.0"
"spatie/pest-expectations": "^1.10"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

1087
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -573,7 +573,7 @@ test('plugin caches image until data is stale', function () {
expect($thirdResponse['filename']) expect($thirdResponse['filename'])
->not->toBe($firstResponse['filename']); ->not->toBe($firstResponse['filename']);
})->skipOnGitHubActions(); })->skipOnCi();
test('plugins in playlist are rendered in order', function () { test('plugins in playlist are rendered in order', function () {
// Create source device with a playlist // Create source device with a playlist
@ -677,7 +677,7 @@ test('plugins in playlist are rendered in order', function () {
$thirdResponse->assertOk(); $thirdResponse->assertOk();
expect($thirdResponse['filename']) expect($thirdResponse['filename'])
->not->toBe($secondResponse['filename']); ->not->toBe($secondResponse['filename']);
})->skipOnGitHubActions(); })->skipOnCi();
test('display endpoint updates last_refreshed_at timestamp', function () { test('display endpoint updates last_refreshed_at timestamp', function () {
$device = Device::factory()->create([ $device = Device::factory()->create([
@ -787,7 +787,7 @@ test('display endpoint handles mashup playlist items correctly', function () {
// Verify the playlist item was marked as displayed // Verify the playlist item was marked as displayed
$playlistItem->refresh(); $playlistItem->refresh();
expect($playlistItem->last_displayed_at)->not->toBeNull(); expect($playlistItem->last_displayed_at)->not->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
test('device in sleep mode returns sleep image and correct refresh rate', function () { test('device in sleep mode returns sleep image and correct refresh rate', function () {
$device = Device::factory()->create([ $device = Device::factory()->create([

View file

@ -23,7 +23,7 @@ test('it generates screen images and updates device', function () {
// Assert both PNG and BMP files were created // Assert both PNG and BMP files were created
$uuid = $device->current_screen_image; $uuid = $device->current_screen_image;
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
test('it cleans up unused images', function () { test('it cleans up unused images', function () {
// Create some test devices with images // Create some test devices with images
@ -45,7 +45,7 @@ test('it cleans up unused images', function () {
Storage::disk('public')->assertMissing('/images/generated/uuid-to-be-replaced.bmp'); Storage::disk('public')->assertMissing('/images/generated/uuid-to-be-replaced.bmp');
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.png'); Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.png');
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.bmp'); Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.bmp');
})->skipOnGitHubActions(); })->skipOnCi();
test('it preserves gitignore file during cleanup', function () { test('it preserves gitignore file during cleanup', function () {
Storage::disk('public')->put('/images/generated/.gitignore', '*'); Storage::disk('public')->put('/images/generated/.gitignore', '*');
@ -55,4 +55,4 @@ test('it preserves gitignore file during cleanup', function () {
$job->handle(); $job->handle();
Storage::disk('public')->assertExists('/images/generated/.gitignore'); Storage::disk('public')->assertExists('/images/generated/.gitignore');
})->skipOnGitHubActions(); })->skipOnCi();

View file

@ -34,7 +34,7 @@ it('generates image for device without device model', function (): void {
// Assert PNG file was created // Assert PNG file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('generates image for device with device model', function (): void { it('generates image for device with device model', function (): void {
// Create a DeviceModel // Create a DeviceModel
@ -64,7 +64,7 @@ it('generates image for device with device model', function (): void {
// Assert PNG file was created // Assert PNG file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('generates 4-color 2-bit PNG with device model', function (): void { it('generates 4-color 2-bit PNG with device model', function (): void {
// Create a DeviceModel for 4-color, 2-bit PNG // Create a DeviceModel for 4-color, 2-bit PNG
@ -125,7 +125,7 @@ it('generates 4-color 2-bit PNG with device model', function (): void {
imagedestroy($image); imagedestroy($image);
expect($hasContent)->toBe(true, 'Image should contain visible content'); expect($hasContent)->toBe(true, 'Image should contain visible content');
})->skipOnGitHubActions(); })->skipOnCi();
it('generates BMP with device model', function (): void { it('generates BMP with device model', function (): void {
// Create a DeviceModel for BMP format // Create a DeviceModel for BMP format
@ -155,7 +155,7 @@ it('generates BMP with device model', function (): void {
// Assert BMP file was created // Assert BMP file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.bmp"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.bmp");
})->skipOnGitHubActions(); })->skipOnCi();
it('applies scale factor from device model', function (): void { it('applies scale factor from device model', function (): void {
// Create a DeviceModel with scale factor // Create a DeviceModel with scale factor
@ -185,7 +185,7 @@ it('applies scale factor from device model', function (): void {
// Assert PNG file was created // Assert PNG file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('applies rotation from device model', function (): void { it('applies rotation from device model', function (): void {
// Create a DeviceModel with rotation // Create a DeviceModel with rotation
@ -215,7 +215,7 @@ it('applies rotation from device model', function (): void {
// Assert PNG file was created // Assert PNG file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('applies offset from device model', function (): void { it('applies offset from device model', function (): void {
// Create a DeviceModel with offset // Create a DeviceModel with offset
@ -245,7 +245,7 @@ it('applies offset from device model', function (): void {
// Assert PNG file was created // Assert PNG file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('falls back to device settings when no device model', function (): void { it('falls back to device settings when no device model', function (): void {
// Create a device with custom settings but no DeviceModel // Create a device with custom settings but no DeviceModel
@ -265,7 +265,7 @@ it('falls back to device settings when no device model', function (): void {
// Assert PNG file was created // Assert PNG file was created
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('handles auto image format for legacy devices', function (): void { it('handles auto image format for legacy devices', function (): void {
// Create a device with AUTO format (legacy behavior) // Create a device with AUTO format (legacy behavior)
@ -286,7 +286,7 @@ it('handles auto image format for legacy devices', function (): void {
// Assert PNG file was created (modern firmware defaults to PNG) // Assert PNG file was created (modern firmware defaults to PNG)
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('cleanupFolder removes unused images', function (): void { it('cleanupFolder removes unused images', function (): void {
// Create active devices with images // Create active devices with images
@ -309,7 +309,7 @@ it('cleanupFolder removes unused images', function (): void {
// Assert inactive files are removed // Assert inactive files are removed
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.png'); Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.png');
Storage::disk('public')->assertMissing('/images/generated/another-inactive.png'); Storage::disk('public')->assertMissing('/images/generated/another-inactive.png');
})->skipOnGitHubActions(); })->skipOnCi();
it('cleanupFolder preserves .gitignore', function (): void { it('cleanupFolder preserves .gitignore', function (): void {
// Create gitignore file // Create gitignore file
@ -323,7 +323,7 @@ it('cleanupFolder preserves .gitignore', function (): void {
// Assert gitignore is preserved // Assert gitignore is preserved
Storage::disk('public')->assertExists('/images/generated/.gitignore'); Storage::disk('public')->assertExists('/images/generated/.gitignore');
})->skipOnGitHubActions(); })->skipOnCi();
it('resetIfNotCacheable resets when device models exist', function (): void { it('resetIfNotCacheable resets when device models exist', function (): void {
// Create a plugin // Create a plugin
@ -340,7 +340,7 @@ it('resetIfNotCacheable resets when device models exist', function (): void {
// Assert plugin image was reset // Assert plugin image was reset
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBeNull(); expect($plugin->current_image)->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
it('resetIfNotCacheable resets when custom dimensions exist', function (): void { it('resetIfNotCacheable resets when custom dimensions exist', function (): void {
// Create a plugin // Create a plugin
@ -358,7 +358,7 @@ it('resetIfNotCacheable resets when custom dimensions exist', function (): void
// Assert plugin image was reset // Assert plugin image was reset
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBeNull(); expect($plugin->current_image)->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
it('resetIfNotCacheable preserves image for standard devices', function (): void { it('resetIfNotCacheable preserves image for standard devices', function (): void {
// Create a plugin // Create a plugin
@ -377,7 +377,7 @@ it('resetIfNotCacheable preserves image for standard devices', function (): void
// Assert plugin image was preserved // Assert plugin image was preserved
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBe('test-uuid'); expect($plugin->current_image)->toBe('test-uuid');
})->skipOnGitHubActions(); })->skipOnCi();
it('determines correct image format from device model', function (): void { it('determines correct image format from device model', function (): void {
// Test BMP format detection // Test BMP format detection
@ -422,7 +422,7 @@ it('determines correct image format from device model', function (): void {
$device3->refresh(); $device3->refresh();
expect($device3->current_screen_image)->toBe($uuid3); expect($device3->current_screen_image)->toBe($uuid3);
Storage::disk('public')->assertExists("/images/generated/{$uuid3}.png"); Storage::disk('public')->assertExists("/images/generated/{$uuid3}.png");
})->skipOnGitHubActions(); })->skipOnCi();
it('generates BMP for legacy device with bmp3_1bit_srgb format', function (): void { it('generates BMP for legacy device with bmp3_1bit_srgb format', function (): void {
// Create a device with BMP format but no DeviceModel (legacy behavior) // Create a device with BMP format but no DeviceModel (legacy behavior)
@ -454,4 +454,4 @@ it('generates BMP for legacy device with bmp3_1bit_srgb format', function (): vo
expect($imageInfo[0])->toBe(800); // Width expect($imageInfo[0])->toBe(800); // Width
expect($imageInfo[1])->toBe(480); // Height expect($imageInfo[1])->toBe(480); // Height
expect($imageInfo[2])->toBe(IMAGETYPE_BMP); // BMP type expect($imageInfo[2])->toBe(IMAGETYPE_BMP); // BMP type
})->skipOnGitHubActions(); })->skipOnCi();

View file

@ -15,8 +15,6 @@ pest()->extend(Tests\TestCase::class)
->use(Illuminate\Foundation\Testing\RefreshDatabase::class) ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
->in('Feature', 'Unit'); ->in('Feature', 'Unit');
registerSpatiePestHelpers();
arch() arch()
->preset() ->preset()
->laravel() ->laravel()

View file

@ -47,7 +47,7 @@ it('get_image_settings returns device model settings when available', function (
expect($settings['offset_x'])->toBe(10); expect($settings['offset_x'])->toBe(10);
expect($settings['offset_y'])->toBe(20); expect($settings['offset_y'])->toBe(20);
expect($settings['use_model_settings'])->toBe(true); expect($settings['use_model_settings'])->toBe(true);
})->skipOnGitHubActions(); })->skipOnCi();
it('get_image_settings falls back to device settings when no device model', function (): void { it('get_image_settings falls back to device settings when no device model', function (): void {
// Create a device without DeviceModel // Create a device without DeviceModel
@ -71,7 +71,7 @@ it('get_image_settings falls back to device settings when no device model', func
expect($settings['rotation'])->toBe(180); expect($settings['rotation'])->toBe(180);
expect($settings['image_format'])->toBe(ImageFormat::PNG_8BIT_GRAYSCALE->value); expect($settings['image_format'])->toBe(ImageFormat::PNG_8BIT_GRAYSCALE->value);
expect($settings['use_model_settings'])->toBe(false); expect($settings['use_model_settings'])->toBe(false);
})->skipOnGitHubActions(); })->skipOnCi();
it('get_image_settings uses defaults for missing device properties', function (): void { it('get_image_settings uses defaults for missing device properties', function (): void {
// Create a device without DeviceModel and missing properties // Create a device without DeviceModel and missing properties
@ -101,7 +101,7 @@ it('get_image_settings uses defaults for missing device properties', function ()
expect($settings['offset_y'])->toBe(0); expect($settings['offset_y'])->toBe(0);
// image_format will be null if the device doesn't have it set, which is the expected behavior // image_format will be null if the device doesn't have it set, which is the expected behavior
expect($settings['image_format'])->toBeNull(); expect($settings['image_format'])->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
it('determine_image_format_from_model returns correct formats', function (): void { it('determine_image_format_from_model returns correct formats', function (): void {
// Use reflection to access private method // Use reflection to access private method
@ -153,7 +153,7 @@ it('determine_image_format_from_model returns correct formats', function (): voi
]); ]);
$format = $method->invoke(null, $unknownModel); $format = $method->invoke(null, $unknownModel);
expect($format)->toBe(ImageFormat::AUTO->value); expect($format)->toBe(ImageFormat::AUTO->value);
})->skipOnGitHubActions(); })->skipOnCi();
it('cleanup_folder identifies active images correctly', function (): void { it('cleanup_folder identifies active images correctly', function (): void {
// Create devices with images // Create devices with images
@ -189,7 +189,7 @@ it('reset_if_not_cacheable detects device models', function (): void {
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBeNull(); expect($plugin->current_image)->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
it('reset_if_not_cacheable detects custom dimensions', function (): void { it('reset_if_not_cacheable detects custom dimensions', function (): void {
// Create a plugin // Create a plugin
@ -206,7 +206,7 @@ it('reset_if_not_cacheable detects custom dimensions', function (): void {
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBeNull(); expect($plugin->current_image)->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
it('reset_if_not_cacheable preserves cache for standard devices', function (): void { it('reset_if_not_cacheable preserves cache for standard devices', function (): void {
// Create a plugin // Create a plugin
@ -224,7 +224,7 @@ it('reset_if_not_cacheable preserves cache for standard devices', function (): v
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBe('test-uuid'); expect($plugin->current_image)->toBe('test-uuid');
})->skipOnGitHubActions(); })->skipOnCi();
it('reset_if_not_cacheable preserves cache for og_png and og_plus device models', function (): void { it('reset_if_not_cacheable preserves cache for og_png and og_plus device models', function (): void {
// Create a plugin // Create a plugin
@ -255,7 +255,7 @@ it('reset_if_not_cacheable preserves cache for og_png and og_plus device models'
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBe('test-uuid'); expect($plugin->current_image)->toBe('test-uuid');
})->skipOnGitHubActions(); })->skipOnCi();
it('reset_if_not_cacheable resets cache for non-standard device models', function (): void { it('reset_if_not_cacheable resets cache for non-standard device models', function (): void {
// Create a plugin // Create a plugin
@ -277,12 +277,12 @@ it('reset_if_not_cacheable resets cache for non-standard device models', functio
$plugin->refresh(); $plugin->refresh();
expect($plugin->current_image)->toBeNull(); expect($plugin->current_image)->toBeNull();
})->skipOnGitHubActions(); })->skipOnCi();
it('reset_if_not_cacheable handles null plugin', function (): void { it('reset_if_not_cacheable handles null plugin', function (): void {
// Test that the method handles null plugin gracefully // Test that the method handles null plugin gracefully
expect(fn () => ImageGenerationService::resetIfNotCacheable(null))->not->toThrow(Exception::class); expect(fn () => ImageGenerationService::resetIfNotCacheable(null))->not->toThrow(Exception::class);
})->skipOnGitHubActions(); })->skipOnCi();
it('image_format enum includes new 2bit 4c format', function (): void { it('image_format enum includes new 2bit 4c format', function (): void {
// Test that the new format is properly defined in the enum // Test that the new format is properly defined in the enum