fixed sanitazer and academy

This commit is contained in:
2026-06-05 16:53:20 +02:00
parent 15870ddb1f
commit f89ee937c0
29 changed files with 2444 additions and 1039 deletions

View File

@@ -213,6 +213,7 @@ it('renders public group pages and accepts group reports', function () {
->component('Group/GroupShow')
->where('group.slug', $group->slug)
->where('section', 'overview')
->where('seo.canonical', route('groups.show', ['group' => $group]))
->where('featuredArtworks.0.id', $featuredArtwork->id)
->where('featuredCollections.0.id', $featuredCollection->id)
->where('leadership.0.role', Group::ROLE_OWNER)
@@ -229,6 +230,27 @@ it('renders public group pages and accepts group reports', function () {
expect(Report::query()->where('target_type', 'group')->where('target_id', $group->id)->count())->toBe(1);
});
it('adds canonical metadata to public group artwork sections', function () {
$owner = User::factory()->create();
$group = Group::factory()->for($owner, 'owner')->create([
'visibility' => Group::VISIBILITY_PUBLIC,
'status' => Group::LIFECYCLE_ACTIVE,
'slug' => 'pixelart',
'name' => 'Pixelart',
]);
app(GroupMembershipService::class)->ensureOwnerMembership($group);
$this->get(route('groups.section', ['group' => $group, 'section' => 'artworks']))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('Group/GroupShow')
->where('section', 'artworks')
->where('seo.canonical', route('groups.section', ['group' => $group, 'section' => 'artworks']))
->where('seo.og_url', route('groups.section', ['group' => $group, 'section' => 'artworks']))
);
});
it('lets owners manage releases, contributors, milestones, and publishing through studio endpoints', function () {
$owner = User::factory()->create();
$contributor = User::factory()->create();
@@ -2195,4 +2217,4 @@ it('publishes and pins posts, hides archived posts from public listings, and sup
->assertCreated();
expect(Report::query()->where('target_type', 'group_post')->where('target_id', $draft->id)->count())->toBe(1);
});
});

View File

@@ -44,6 +44,8 @@ it('forbids newsroom studio pages for non moderators', function (): void {
});
it('renders newsroom studio pages for moderators', function (): void {
Carbon::setTestNow(Carbon::parse('2026-06-04 13:45:00'));
$moderator = User::factory()->create([
'role' => 'moderator',
'username' => 'modnews',
@@ -88,7 +90,9 @@ it('renders newsroom studio pages for moderators', function (): void {
->has('statusOptions')
->has('categoryOptions')
->has('tagOptions')
->where('defaultAuthor.id', $moderator->id));
->where('defaultAuthor.id', $moderator->id)
->where('defaultAuthor.title', 'Moderator News')
->where('defaultPublishedAt', '2026-06-04T13:45'));
$this->actingAs($moderator)
->get(route('studio.news.categories'))
@@ -104,6 +108,8 @@ it('renders newsroom studio pages for moderators', function (): void {
->assertOk()
->assertSee('Preview mode')
->assertSee('Moderated newsroom article');
Carbon::setTestNow();
});
it('decodes legacy apostrophe entities in the newsroom editor', function (): void {

View File

@@ -3,6 +3,7 @@
declare(strict_types=1);
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\Models\Tag;
use App\Models\User;
uses(RefreshDatabase::class);
@@ -33,6 +34,50 @@ it('renders seo tags on auth blade pages', function (): void {
$this->assertStringContainsString('meta name="robots" content="noindex,nofollow"', $html);
});
it('renders canonical tags on public discovery and creator pages', function (string $url, string $routeName): void {
$response = $this->get($url);
$response->assertOk();
$html = $response->getContent();
$this->assertNotFalse($html);
$this->assertStringContainsString('<link rel="canonical" href="' . route($routeName) . '" />', $html);
})->with([
'discover on this day' => ['/discover/on-this-day', 'discover.on-this-day'],
'discover rising' => ['/discover/rising', 'discover.rising'],
'discover top rated' => ['/discover/top-rated', 'discover.top-rated'],
'discover most downloaded' => ['/discover/most-downloaded', 'discover.most-downloaded'],
'discover fresh' => ['/discover/fresh', 'discover.fresh'],
'discover trending' => ['/discover/trending', 'discover.trending'],
'top creators' => ['/creators/top', 'creators.top'],
]);
it('renders a canonical tag on the register page', function (): void {
$response = $this->get('/register');
$response->assertOk();
$html = $response->getContent();
$this->assertNotFalse($html);
$this->assertStringContainsString('<link rel="canonical" href="' . route('register') . '" />', $html);
});
it('renders canonical atom links in rss feed headers', function (): void {
Tag::factory()->create([
'name' => 'Abstract Composition',
'slug' => 'abstract-composition',
'is_active' => true,
]);
$this->get('/rss')
->assertOk()
->assertSee('<atom:link href="' . route('rss.global') . '" rel="canonical" />', false);
$this->get('/rss/tag/abstract-composition')
->assertOk()
->assertSee('<atom:link href="' . route('rss.tag', ['slug' => 'abstract-composition']) . '" rel="canonical" />', false);
});
it('renders seo tags on upload and studio pages', function (): void {
$user = User::factory()->create();

View File

@@ -98,7 +98,8 @@ it('renders public worlds index and detail pages', function (): void {
->assertInertia(fn (AssertableInertia $page) => $page
->component('World/WorldShow')
->where('world.title', 'Summer Slam 2026')
->where('world.slug', 'summer-slam-2026'));
->where('world.slug', 'summer-slam-2026')
->where('seo.canonical', route('worlds.show', ['world' => $world->slug])));
});
it('returns a relative latest world navigation link regardless of request host', function (): void {
@@ -909,4 +910,4 @@ it('splits live, upcoming, and archived worlds on the public index', function ()
->has('recurringWorldFamilies', 1)
->where('recurringWorldFamilies.0.title', 'Spring Vibes')
->has('archivedWorlds', 2));
});
});