Files
WMS/Modules/Helpdesk/Tests/Feature/TicketTimerSecondsFilesTest.php
2026-09-21 10:14:57 +01:00

40 lines
1.7 KiB
PHP
Executable File

<?php
namespace Modules\Helpdesk\Tests\Feature;
use Tests\TestCase;
class TicketTimerSecondsFilesTest extends TestCase
{
/**
* Timer files must support seconds storage and display.
*/
public function test_timer_supports_seconds_storage_and_display(): void
{
$component = (string) file_get_contents(base_path('Modules/Helpdesk/Livewire/TicketTimer.php'));
$model = (string) file_get_contents(base_path('Modules/Helpdesk/Models/TicketTimeLog.php'));
$view = (string) file_get_contents(base_path('Modules/Helpdesk/Resources/views/livewire/ticket-timer.blade.php'));
$this->assertStringContainsString("'seconds'", $component);
$this->assertStringContainsString("'seconds'", $model);
$this->assertStringContainsString('diffInSeconds', $component);
$this->assertStringContainsString("sum('seconds')", $component);
$this->assertStringContainsString('formatElapsed', $view);
$this->assertStringContainsString('data-helpdesk-live-elapsed', $view);
$this->assertStringNotContainsString('localStorage', $component);
$this->assertStringNotContainsString('localStorage', $view);
}
/**
* The history query partial should read persisted timer logs directly.
*/
public function test_history_query_reads_ticket_time_logs_directly(): void
{
$partial = (string) file_get_contents(base_path('Modules/Helpdesk/Resources/views/partials/ticket-time-log-history-query.blade.php'));
$this->assertStringContainsString('TicketTimeLog::query()', $partial);
$this->assertStringContainsString("whereNotNull('ended_at')", $partial);
$this->assertStringContainsString('seconds', $partial);
}
}