It fixes the remaining stale test and keeps the actual N+1 strategy:

* Main ticket index renders scalar agent_name.
* Ticket index still eager-loads user, owner, agent.
* Ticket show comments no longer eager-load fake owner / agent relations.
* Updated the conflicting regression tests.
This commit is contained in:
Mark Gregory
2026-06-26 12:07:09 +01:00
parent 788bb87b01
commit 86f0082a84
12 changed files with 94 additions and 18 deletions
@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Modules\Helpdesk\Tests\Feature;
use Tests\TestCase;
final class TicketShowCommentRelationsFilesTest extends TestCase
{
public function test_ticket_show_only_eager_loads_real_comment_relations(): void
{
$source = file_get_contents(dirname(__DIR__, 2) . '/Livewire/TicketShow.php');
self::assertIsString($source);
self::assertStringContainsString("->with(['user.company', 'attachments'])", $source);
self::assertStringNotContainsString("->with(['user.company', 'owner:id,name,email,company_id', 'agent:id,name,email', 'attachments'])", $source);
}
}