phases one of time logged now with log display
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Helpdesk\Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class TicketTimerFilesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* The Livewire timer view must keep its root element first.
|
||||
*/
|
||||
public function test_ticket_timer_view_does_not_start_with_a_style_tag(): void
|
||||
{
|
||||
$view = trim((string) file_get_contents(base_path('Modules/Helpdesk/resources/views/livewire/ticket-timer.blade.php')));
|
||||
|
||||
$this->assertStringStartsWith('<div', $view);
|
||||
$this->assertFalse(
|
||||
str_starts_with($view, '<style'),
|
||||
'The ticket timer Livewire view must not start with a <style> tag.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The timer must be database backed rather than session/localStorage backed.
|
||||
*/
|
||||
public function test_ticket_timer_is_not_session_or_local_storage_backed(): 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'));
|
||||
|
||||
$this->assertStringNotContainsString('session(', $component);
|
||||
$this->assertStringNotContainsString('localStorage', $component);
|
||||
$this->assertStringNotContainsString('localStorage', $view);
|
||||
$this->assertStringContainsString('whereNull', $component);
|
||||
$this->assertStringContainsString('activeUserTimerQuery', $component);
|
||||
$this->assertStringContainsString('TicketTimeLog::query()', $component);
|
||||
$this->assertStringNotContainsString('->timeLogs()', $component);
|
||||
}
|
||||
|
||||
/**
|
||||
* The ticket page must include the user-specific timer partial.
|
||||
*/
|
||||
public function test_ticket_show_timer_partial_exists(): void
|
||||
{
|
||||
$this->assertFileExists(base_path('Modules/Helpdesk/resources/views/partials/ticket-time-timer.blade.php'));
|
||||
$this->assertFileExists(base_path('Modules/Helpdesk/resources/views/livewire/ticket-timer.blade.php'));
|
||||
$this->assertFileExists(base_path('Modules/Helpdesk/Livewire/TicketTimer.php'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user