Implement academy analytics, billing, and web stories updates

This commit is contained in:
2026-05-26 07:27:29 +02:00
parent 456c3d6bb0
commit 0b33a1b074
177 changed files with 27360 additions and 2685 deletions

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use App\Models\WorldWebStory;
use App\Models\WorldWebStoryPage;
use App\Services\WebStories\WorldWebStoryValidationService;
it('fails validation for missing poster, too few pages, long body, and missing background media', function (): void {
$story = WorldWebStory::factory()->published()->create([
'poster_portrait_path' => null,
'publisher_logo_path' => 'https://cdn.skinbase.org/images/skinbase_logo_96.webp',
]);
WorldWebStoryPage::factory()->for($story, 'story')->create([
'position' => 1,
'background_type' => WorldWebStoryPage::BACKGROUND_IMAGE,
'background_path' => null,
'background_mobile_path' => null,
'alt_text' => '',
'body' => str_repeat('a', 181),
]);
$result = app(WorldWebStoryValidationService::class)->validate($story->fresh('orderedPages'));
expect($result['valid'])->toBeFalse()
->and($result['errors'])->toContain('Poster portrait image is required.')
->and($result['errors'])->toContain('A published web story must have at least 5 active pages.')
->and(collect($result['errors'])->contains(fn (string $error): bool => str_contains($error, 'body exceeds 180 characters')))->toBeTrue()
->and(collect($result['errors'])->contains(fn (string $error): bool => str_contains($error, 'missing required background media')))->toBeTrue();
});