48 lines
2.1 KiB
PHP
Executable File
48 lines
2.1 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Tests\Feature;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class TicketGitCommitDisplayFilesTest extends TestCase
|
|
{
|
|
public function test_ticket_show_uses_safe_bound_git_commit_lookup_without_raw_like_sql(): void
|
|
{
|
|
$component = file_get_contents(__DIR__ . '/../../Livewire/TicketShow.php');
|
|
|
|
self::assertIsString($component);
|
|
self::assertStringContainsString("setRelation('gitCommits'", $component);
|
|
self::assertStringContainsString("orWhere('message', 'ILIKE'", $component);
|
|
self::assertStringContainsString("orWhere('branch', 'ILIKE'", $component);
|
|
self::assertStringContainsString("orWhere('url', 'ILIKE'", $component);
|
|
self::assertStringNotContainsString('orWhereRaw', $component);
|
|
self::assertStringNotContainsString('lower(message) like', strtolower($component));
|
|
}
|
|
|
|
/**
|
|
* Directly linked commits must still display even when historical repository ownership is inconsistent.
|
|
*/
|
|
public function test_ticket_show_keeps_directly_linked_git_commits_visible_before_repository_scope(): void
|
|
{
|
|
$component = file_get_contents(__DIR__ . '/../../Livewire/TicketShow.php');
|
|
|
|
self::assertIsString($component);
|
|
self::assertStringContainsString("\$scopeQuery->where('ticket_id', \$ticket->id)", $component);
|
|
self::assertStringContainsString("->orWhereHas('repository'", $component);
|
|
self::assertStringContainsString('HD-2026-00026', 'HD-2026-00026');
|
|
}
|
|
|
|
public function test_ticket_show_preserves_livewire_safe_expandable_sidebar_cards(): void
|
|
{
|
|
$view = file_get_contents(__DIR__ . '/../../Resources/views/livewire/ticket-show.blade.php');
|
|
|
|
self::assertIsString($view);
|
|
self::assertStringContainsString('data-helpdesk-sidebar-cards', $view);
|
|
self::assertStringContainsString('livewire:navigated', $view);
|
|
self::assertStringContainsString('data-helpdesk-sidebar-card-header', $view);
|
|
self::assertStringNotContainsString("document.createElement('details')", $view);
|
|
}
|
|
}
|