mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
This commit is contained in:
parent
414ca47cbf
commit
f1d5c196e8
8 changed files with 544 additions and 618 deletions
|
|
@ -207,7 +207,7 @@ avatar, badge, brand, breadcrumbs, button, callout, checkbox, dropdown, field, h
|
|||
|
||||
## Livewire Core
|
||||
- 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.
|
||||
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.
|
||||
|
||||
|
|
|
|||
|
|
@ -35,10 +35,9 @@
|
|||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"pestphp/pest": "^3.7",
|
||||
"pestphp/pest-plugin-drift": "^3.0",
|
||||
"pestphp/pest-plugin-laravel": "^3.1",
|
||||
"spatie/pest-expectations": "^1.10"
|
||||
"pestphp/pest": "^4.0",
|
||||
"pestphp/pest-plugin-drift": "^4.0",
|
||||
"pestphp/pest-plugin-laravel": "^4.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
|
|||
1087
composer.lock
generated
1087
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -573,7 +573,7 @@ test('plugin caches image until data is stale', function () {
|
|||
|
||||
expect($thirdResponse['filename'])
|
||||
->not->toBe($firstResponse['filename']);
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
test('plugins in playlist are rendered in order', function () {
|
||||
// Create source device with a playlist
|
||||
|
|
@ -677,7 +677,7 @@ test('plugins in playlist are rendered in order', function () {
|
|||
$thirdResponse->assertOk();
|
||||
expect($thirdResponse['filename'])
|
||||
->not->toBe($secondResponse['filename']);
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
test('display endpoint updates last_refreshed_at timestamp', function () {
|
||||
$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
|
||||
$playlistItem->refresh();
|
||||
expect($playlistItem->last_displayed_at)->not->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
test('device in sleep mode returns sleep image and correct refresh rate', function () {
|
||||
$device = Device::factory()->create([
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ test('it generates screen images and updates device', function () {
|
|||
// Assert both PNG and BMP files were created
|
||||
$uuid = $device->current_screen_image;
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
test('it cleans up unused images', function () {
|
||||
// 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/inactive-uuid.png');
|
||||
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.bmp');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
test('it preserves gitignore file during cleanup', function () {
|
||||
Storage::disk('public')->put('/images/generated/.gitignore', '*');
|
||||
|
|
@ -55,4 +55,4 @@ test('it preserves gitignore file during cleanup', function () {
|
|||
$job->handle();
|
||||
|
||||
Storage::disk('public')->assertExists('/images/generated/.gitignore');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ it('generates image for device without device model', function (): void {
|
|||
|
||||
// Assert PNG file was created
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('generates image for device with device model', function (): void {
|
||||
// Create a DeviceModel
|
||||
|
|
@ -64,7 +64,7 @@ it('generates image for device with device model', function (): void {
|
|||
|
||||
// Assert PNG file was created
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('generates 4-color 2-bit PNG with device model', function (): void {
|
||||
// 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);
|
||||
expect($hasContent)->toBe(true, 'Image should contain visible content');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('generates BMP with device model', function (): void {
|
||||
// Create a DeviceModel for BMP format
|
||||
|
|
@ -155,7 +155,7 @@ it('generates BMP with device model', function (): void {
|
|||
|
||||
// Assert BMP file was created
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.bmp");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('applies scale factor from device model', function (): void {
|
||||
// Create a DeviceModel with scale factor
|
||||
|
|
@ -185,7 +185,7 @@ it('applies scale factor from device model', function (): void {
|
|||
|
||||
// Assert PNG file was created
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('applies rotation from device model', function (): void {
|
||||
// Create a DeviceModel with rotation
|
||||
|
|
@ -215,7 +215,7 @@ it('applies rotation from device model', function (): void {
|
|||
|
||||
// Assert PNG file was created
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('applies offset from device model', function (): void {
|
||||
// Create a DeviceModel with offset
|
||||
|
|
@ -245,7 +245,7 @@ it('applies offset from device model', function (): void {
|
|||
|
||||
// Assert PNG file was created
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('falls back to device settings when no device model', function (): void {
|
||||
// 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
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('handles auto image format for legacy devices', function (): void {
|
||||
// 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)
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('cleanupFolder removes unused images', function (): void {
|
||||
// Create active devices with images
|
||||
|
|
@ -309,7 +309,7 @@ it('cleanupFolder removes unused images', function (): void {
|
|||
// Assert inactive files are removed
|
||||
Storage::disk('public')->assertMissing('/images/generated/inactive-uuid.png');
|
||||
Storage::disk('public')->assertMissing('/images/generated/another-inactive.png');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('cleanupFolder preserves .gitignore', function (): void {
|
||||
// Create gitignore file
|
||||
|
|
@ -323,7 +323,7 @@ it('cleanupFolder preserves .gitignore', function (): void {
|
|||
|
||||
// Assert gitignore is preserved
|
||||
Storage::disk('public')->assertExists('/images/generated/.gitignore');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('resetIfNotCacheable resets when device models exist', function (): void {
|
||||
// Create a plugin
|
||||
|
|
@ -340,7 +340,7 @@ it('resetIfNotCacheable resets when device models exist', function (): void {
|
|||
// Assert plugin image was reset
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('resetIfNotCacheable resets when custom dimensions exist', function (): void {
|
||||
// Create a plugin
|
||||
|
|
@ -358,7 +358,7 @@ it('resetIfNotCacheable resets when custom dimensions exist', function (): void
|
|||
// Assert plugin image was reset
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('resetIfNotCacheable preserves image for standard devices', function (): void {
|
||||
// Create a plugin
|
||||
|
|
@ -377,7 +377,7 @@ it('resetIfNotCacheable preserves image for standard devices', function (): void
|
|||
// Assert plugin image was preserved
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBe('test-uuid');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('determines correct image format from device model', function (): void {
|
||||
// Test BMP format detection
|
||||
|
|
@ -422,7 +422,7 @@ it('determines correct image format from device model', function (): void {
|
|||
$device3->refresh();
|
||||
expect($device3->current_screen_image)->toBe($uuid3);
|
||||
Storage::disk('public')->assertExists("/images/generated/{$uuid3}.png");
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('generates BMP for legacy device with bmp3_1bit_srgb format', function (): void {
|
||||
// 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[1])->toBe(480); // Height
|
||||
expect($imageInfo[2])->toBe(IMAGETYPE_BMP); // BMP type
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ pest()->extend(Tests\TestCase::class)
|
|||
->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
|
||||
->in('Feature', 'Unit');
|
||||
|
||||
registerSpatiePestHelpers();
|
||||
|
||||
arch()
|
||||
->preset()
|
||||
->laravel()
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ it('get_image_settings returns device model settings when available', function (
|
|||
expect($settings['offset_x'])->toBe(10);
|
||||
expect($settings['offset_y'])->toBe(20);
|
||||
expect($settings['use_model_settings'])->toBe(true);
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('get_image_settings falls back to device settings when no device model', function (): void {
|
||||
// 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['image_format'])->toBe(ImageFormat::PNG_8BIT_GRAYSCALE->value);
|
||||
expect($settings['use_model_settings'])->toBe(false);
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('get_image_settings uses defaults for missing device properties', function (): void {
|
||||
// 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);
|
||||
// image_format will be null if the device doesn't have it set, which is the expected behavior
|
||||
expect($settings['image_format'])->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('determine_image_format_from_model returns correct formats', function (): void {
|
||||
// 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);
|
||||
expect($format)->toBe(ImageFormat::AUTO->value);
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('cleanup_folder identifies active images correctly', function (): void {
|
||||
// Create devices with images
|
||||
|
|
@ -189,7 +189,7 @@ it('reset_if_not_cacheable detects device models', function (): void {
|
|||
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('reset_if_not_cacheable detects custom dimensions', function (): void {
|
||||
// Create a plugin
|
||||
|
|
@ -206,7 +206,7 @@ it('reset_if_not_cacheable detects custom dimensions', function (): void {
|
|||
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('reset_if_not_cacheable preserves cache for standard devices', function (): void {
|
||||
// Create a plugin
|
||||
|
|
@ -224,7 +224,7 @@ it('reset_if_not_cacheable preserves cache for standard devices', function (): v
|
|||
|
||||
$plugin->refresh();
|
||||
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 {
|
||||
// Create a plugin
|
||||
|
|
@ -255,7 +255,7 @@ it('reset_if_not_cacheable preserves cache for og_png and og_plus device models'
|
|||
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBe('test-uuid');
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('reset_if_not_cacheable resets cache for non-standard device models', function (): void {
|
||||
// Create a plugin
|
||||
|
|
@ -277,12 +277,12 @@ it('reset_if_not_cacheable resets cache for non-standard device models', functio
|
|||
|
||||
$plugin->refresh();
|
||||
expect($plugin->current_image)->toBeNull();
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('reset_if_not_cacheable handles null plugin', function (): void {
|
||||
// Test that the method handles null plugin gracefully
|
||||
expect(fn () => ImageGenerationService::resetIfNotCacheable(null))->not->toThrow(Exception::class);
|
||||
})->skipOnGitHubActions();
|
||||
})->skipOnCi();
|
||||
|
||||
it('image_format enum includes new 2bit 4c format', function (): void {
|
||||
// Test that the new format is properly defined in the enum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue