phases one of time logged now with log display
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Helpdesk\Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class TicketTimerLiveDisplayFilesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* The timer display must tick in the browser from the database-backed started_at value.
|
||||
*/
|
||||
public function test_timer_view_has_browser_side_running_display_without_local_storage(): void
|
||||
{
|
||||
$view = (string) file_get_contents(base_path('Modules/Helpdesk/resources/views/livewire/ticket-timer.blade.php'));
|
||||
|
||||
$this->assertStringContainsString('x-data', $view);
|
||||
$this->assertStringContainsString('Date.parse', $view);
|
||||
$this->assertStringContainsString('setInterval', $view);
|
||||
$this->assertStringContainsString('started_at', $view);
|
||||
$this->assertStringContainsString('data-dusk="ticket-running-time"', $view);
|
||||
$this->assertStringNotContainsString('localStorage', $view);
|
||||
$this->assertStringNotContainsString('sessionStorage', $view);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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('HH:MM:SS', 'HH:MM:SS');
|
||||
$this->assertStringContainsString('formatted()', $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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user