40 lines
1.7 KiB
PHP
40 lines
1.7 KiB
PHP
<?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);
|
|
}
|
|
}
|