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

@@ -106,6 +106,38 @@ it('renders newsroom studio pages for moderators', function (): void {
->assertSee('Moderated newsroom article');
});
it('decodes legacy apostrophe entities in the newsroom editor', function (): void {
$moderator = User::factory()->create([
'role' => 'moderator',
'username' => 'modedit',
'name' => 'Moderator Edit',
]);
$author = User::factory()->create([
'username' => 'writeredit',
'name' => 'Writer Edit',
]);
$category = studioNewsCategory();
$article = NewsArticle::query()->create([
'title' => 'Ericsson ENGINE to expand Telia´s international carrier network',
'slug' => 'ericsson-engine-to-expand-telias-international-carrier-network',
'excerpt' => 'Studio-managed newsroom article.',
'content' => 'Studio body',
'author_id' => $author->id,
'category_id' => $category->id,
'type' => NewsArticle::TYPE_EDITORIAL,
'status' => 'draft',
'editorial_status' => NewsArticle::EDITORIAL_STATUS_DRAFT,
]);
$this->actingAs($moderator)
->get(route('studio.news.edit', ['article' => $article->id]))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('Studio/StudioNewsEditor')
->where('article.title', "Ericsson ENGINE to expand Telia's international carrier network"));
});
it('filters newsroom listing by status type and category', function (): void {
$moderator = User::factory()->create([
'role' => 'moderator',
@@ -172,6 +204,46 @@ it('filters newsroom listing by status type and category', function (): void {
->where('listing.items.0.title', 'Keep Me'));
});
it('paginates newsroom listing', function (): void {
$moderator = User::factory()->create([
'role' => 'moderator',
]);
$author = User::factory()->create();
foreach (range(1, 16) as $index) {
NewsArticle::query()->create([
'title' => "Paged Article {$index}",
'slug' => "paged-article-{$index}",
'excerpt' => 'Paginated newsroom article.',
'content' => 'Content',
'author_id' => $author->id,
'type' => NewsArticle::TYPE_ANNOUNCEMENT,
'status' => 'draft',
'editorial_status' => NewsArticle::EDITORIAL_STATUS_DRAFT,
]);
}
$this->actingAs($moderator)
->get(route('studio.news.index'))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('Studio/StudioNewsIndex')
->where('listing.meta.current_page', 1)
->where('listing.meta.last_page', 2)
->where('listing.meta.total', 16)
->has('listing.items', 15));
$this->actingAs($moderator)
->get(route('studio.news.index', ['page' => 2]))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('Studio/StudioNewsIndex')
->where('listing.meta.current_page', 2)
->where('listing.meta.last_page', 2)
->where('listing.meta.total', 16)
->has('listing.items', 1));
});
it('stores a newsroom draft with taxonomy links', function (): void {
$moderator = User::factory()->create([
'role' => 'moderator',
@@ -220,6 +292,8 @@ it('stores a newsroom draft with taxonomy links', function (): void {
'status' => 'draft',
]);
expect($article->canonical_url)->toBe(route('news.show', ['slug' => 'stored-newsroom-draft']));
expect($article->tags()->pluck('news_tags.name')->all())
->toContain('Update')
->toContain('Studio Exclusive');