Files
WMS/Modules/Helpdesk/Tests/Feature/TicketGitCommitDisplayFilesTest.php
T

35 lines
1.4 KiB
PHP

<?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));
}
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);
}
}