withoutMiddleware(HandleInertiaRequests::class); }); it('renders discussion forum structured data on forum topic pages', function (): void { $author = User::query()->create([ 'username' => 'forumauthor', 'username_changed_at' => now()->subDays(120), 'last_username_change_at' => now()->subDays(120), 'onboarding_step' => 'complete', 'name' => 'Forum Author', 'email' => 'forumauthor@example.com', 'email_verified_at' => now(), 'password' => 'password', 'is_active' => true, ]); $replier = User::query()->create([ 'username' => 'forumreplier', 'username_changed_at' => now()->subDays(120), 'last_username_change_at' => now()->subDays(120), 'onboarding_step' => 'complete', 'name' => 'Forum Replier', 'email' => 'forumreplier@example.com', 'email_verified_at' => now(), 'password' => 'password', 'is_active' => true, ]); $category = ForumCategory::query()->create([ 'name' => 'Forum SEO', 'title' => 'Forum SEO', 'slug' => 'forum-seo', 'description' => 'SEO discussion category', 'is_active' => true, 'position' => 1, ]); $board = ForumBoard::query()->create([ 'category_id' => $category->id, 'title' => 'Technical SEO', 'slug' => 'technical-seo', 'description' => 'Technical SEO board', 'is_active' => true, 'position' => 1, ]); $topic = ForumTopic::query()->create([ 'board_id' => $board->id, 'user_id' => $author->id, 'title' => 'Structured data for forums', 'slug' => 'structured-data-for-forums', 'views' => 42, 'replies_count' => 1, 'last_post_at' => now(), ]); ForumPost::query()->create([ 'thread_id' => $topic->id, 'topic_id' => $topic->id, 'user_id' => $author->id, 'content' => 'Original post body about Google discussion structured data.', 'created_at' => now()->subHour(), 'updated_at' => now()->subHour(), ]); $reply = ForumPost::query()->create([ 'thread_id' => $topic->id, 'topic_id' => $topic->id, 'user_id' => $replier->id, 'content' => 'Reply with implementation details for the forum page.', 'created_at' => now()->subMinutes(15), 'updated_at' => now()->subMinutes(15), ]); $response = $this->get(route('forum.topic.show', ['topic' => $topic->slug])); $response ->assertOk() ->assertSee('application/ld+json', false) ->assertSee('DiscussionForumPosting', false) ->assertSee('itemtype="https://schema.org/DiscussionForumPosting"', false) ->assertSee('itemprop="comment"', false) ->assertSee('itemtype="https://schema.org/Comment"', false) ->assertSee('itemprop="headline"', false) ->assertSee('itemprop="mainEntityOfPage"', false) ->assertSee('Structured data for forums', false) ->assertSee('Original post body about Google discussion structured data.', false) ->assertSee('Reply with implementation details for the forum page.', false) ->assertSee(route('forum.topic.show', ['topic' => $topic->slug]) . '#post-' . $reply->id, false) ->assertSee(route('profile.show', ['username' => 'forumauthor']), false) ->assertSee(route('profile.show', ['username' => 'forumreplier']), false); }); it('renders item list microdata on forum board pages', function (): void { $author = User::query()->create([ 'username' => 'boardauthor', 'username_changed_at' => now()->subDays(120), 'last_username_change_at' => now()->subDays(120), 'onboarding_step' => 'complete', 'name' => 'Board Author', 'email' => 'boardauthor@example.com', 'email_verified_at' => now(), 'password' => 'password', 'is_active' => true, ]); $category = ForumCategory::query()->create([ 'name' => 'Forum Boards', 'title' => 'Forum Boards', 'slug' => 'forum-boards', 'description' => 'Board category', 'is_active' => true, 'position' => 1, ]); $board = ForumBoard::query()->create([ 'category_id' => $category->id, 'title' => 'Board Microdata', 'slug' => 'board-microdata', 'description' => 'Board microdata description', 'is_active' => true, 'position' => 1, ]); $topic = ForumTopic::query()->create([ 'board_id' => $board->id, 'user_id' => $author->id, 'title' => 'Board topic title', 'slug' => 'board-topic-title', 'replies_count' => 2, 'created_at' => now()->subHour(), 'last_post_at' => now(), ]); ForumPost::query()->create([ 'thread_id' => $topic->id, 'topic_id' => $topic->id, 'user_id' => $author->id, 'content' => 'Board topic opening post content.', 'created_at' => now()->subHour(), 'updated_at' => now()->subHour(), ]); $this->get(route('forum.board.show', ['boardSlug' => $board->slug])) ->assertOk() ->assertSee('itemtype="https://schema.org/CollectionPage"', false) ->assertSee('itemtype="https://schema.org/ItemList"', false) ->assertSee('itemtype="https://schema.org/ListItem"', false) ->assertSee('itemtype="https://schema.org/DiscussionForumPosting"', false) ->assertSee('itemprop="datePublished"', false) ->assertSee('Board topic title', false) ->assertSee(route('forum.topic.show', ['topic' => $topic->slug]), false) ->assertSee(route('profile.show', ['username' => 'boardauthor']), false); }); it('renders item list microdata on forum section pages', function (): void { $category = ForumCategory::query()->create([ 'name' => 'Photography', 'title' => 'Photography', 'slug' => 'photography-section-microdata', 'description' => 'Photography category', 'is_active' => true, 'position' => 1, ]); $board = ForumBoard::query()->create([ 'category_id' => $category->id, 'title' => 'Photography Board', 'slug' => 'photography-board-microdata', 'description' => 'Photography board description', 'is_active' => true, 'position' => 1, ]); $this->get(route('forum.category.show', ['categorySlug' => $category->slug])) ->assertOk() ->assertSee('itemtype="https://schema.org/CollectionPage"', false) ->assertSee('itemtype="https://schema.org/ItemList"', false) ->assertSee('itemtype="https://schema.org/ListItem"', false) ->assertSee(route('forum.category.show', ['categorySlug' => $category->slug]), false) ->assertSee(route('forum.board.show', ['boardSlug' => $board->slug]), false) ->assertSee('Photography boards', false) ->assertSee('Photography Board', false); });