Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -13,6 +13,7 @@ use App\Models\NovaCardCategory;
use App\Models\NovaCardBackground;
use App\Models\NovaCardTemplate;
use App\Models\User;
use App\Services\NovaCards\NovaCardBackgroundService;
use App\Services\NovaCards\NovaCardRenderService;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Arr;
@@ -413,6 +414,40 @@ it('rejects malformed background uploads without throwing', function (): void {
@unlink($tempPath);
});
it('stores uploaded backgrounds when real path falls back to pathname', function (): void {
Storage::fake('local');
Storage::fake('public');
config()->set('nova_cards.storage.private_disk', 'local');
config()->set('nova_cards.storage.public_disk', 'public');
$user = User::factory()->create();
$tempFile = UploadedFile::fake()->image('background.png', 1400, 1000);
$pathname = $tempFile->getPathname();
$upload = new class($pathname) extends UploadedFile {
public function __construct(string $path)
{
parent::__construct($path, 'background.png', 'image/png', \UPLOAD_ERR_OK, true);
}
public function getRealPath(): string|false
{
return false;
}
};
$background = app(NovaCardBackgroundService::class)->storeUploadedBackground($user, $upload);
expect($background->width)->toBe(1400)
->and($background->height)->toBe(1000)
->and($background->sha256)->not->toBeNull();
Storage::disk('local')->assertExists($background->original_path);
Storage::disk('public')->assertExists($background->processed_path);
});
it('renders a draft preview through the render endpoint', function (): void {
$user = User::factory()->create();
$card = draftCard($user);

View File

@@ -362,6 +362,12 @@ it('renders the public card detail page and increments views', function (): void
->toContain('Copy link')
->toContain('data-card-report');
expect(substr_count($response->getContent(), 'property="og:title"'))->toBe(1);
expect(substr_count($response->getContent(), '<link rel="canonical"'))->toBe(1);
expect($response->getContent())
->toContain('property="og:image"')
->toContain('application/ld+json');
expect($card->fresh()->views_count)->toBe(8);
Event::assertDispatched(NovaCardViewed::class);
});

View File

@@ -118,11 +118,11 @@ it('renders the studio cards index with user stats and edit endpoints', function
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('Studio/StudioCardsIndex')
->where('stats.all', 1)
->where('stats.drafts', 1)
->where('cards.data.0.title', 'My Studio Draft')
->where('endpoints.create', route('studio.cards.create'))
->where('endpoints.draftStore', route('api.cards.drafts.store')));
->where('title', 'Cards')
->where('summary.count', 1)
->where('summary.draft_count', 1)
->where('listing.items.0.title', 'My Studio Draft')
->where('publicBrowseUrl', '/cards'));
});
it('renders the create editor with preview mode disabled', function (): void {