27 lines
1.3 KiB
PHP
Executable File
27 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Modules\Helpdesk\Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class TicketTimerStartDisplayFilesTest extends TestCase
|
|
{
|
|
/**
|
|
* The component must hydrate the active timer immediately after start so the running card displays.
|
|
*/
|
|
public function test_start_timer_refreshes_running_display_state(): void
|
|
{
|
|
$component = (string) file_get_contents(base_path('Modules/Helpdesk/Livewire/TicketTimer.php'));
|
|
$view = (string) file_get_contents(base_path('Modules/Helpdesk/resources/views/livewire/ticket-timer.blade.php'));
|
|
$partial = (string) file_get_contents(base_path('Modules/Helpdesk/resources/views/partials/ticket-time-timer.blade.php'));
|
|
|
|
$this->assertStringContainsString('$this->activeTimer = $timer->fresh();', $component);
|
|
$this->assertStringContainsString('$this->elapsedSeconds = 0;', $component);
|
|
$this->assertStringContainsString("dispatch('timer-started')", $component);
|
|
$this->assertStringContainsString('$hasRunningTimer = $activeTimer && $activeTimer->ended_at === null;', $view);
|
|
$this->assertStringContainsString('data-helpdesk-live-elapsed', $view);
|
|
$this->assertStringContainsString("@livewire('helpdesk.ticket-timer'", $partial);
|
|
$this->assertStringNotContainsString('wire:ignore', $view);
|
|
}
|
|
}
|