71 lines
3.0 KiB
PHP
71 lines
3.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* TicketDeveloperActionsUiFilesTest.php
|
|
*
|
|
* Guards the ticket-level developer actions workflow against UI regressions.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Tests\Feature;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class TicketDeveloperActionsUiFilesTest extends TestCase
|
|
{
|
|
/**
|
|
* Ensure the Git activity card has been promoted to a complete developer actions panel.
|
|
*/
|
|
public function test_ticket_show_exposes_developer_actions_panel(): void
|
|
{
|
|
$viewPath = dirname(__DIR__, 2) . '/Resources/views/livewire/ticket-show.blade.php';
|
|
$view = file_get_contents($viewPath);
|
|
|
|
self::assertIsString($view);
|
|
self::assertStringContainsString('data-helpdesk-developer-actions', $view);
|
|
self::assertStringContainsString('Developer actions', $view);
|
|
self::assertStringContainsString('Open repo', $view);
|
|
self::assertStringContainsString('Open branch', $view);
|
|
self::assertStringContainsString('Pull requests', $view);
|
|
self::assertStringContainsString('Activity status', $view);
|
|
}
|
|
|
|
/**
|
|
* Ensure the panel keeps copyable GitFlow branch, commit and pull request templates.
|
|
*/
|
|
public function test_ticket_show_exposes_copyable_gitflow_templates(): void
|
|
{
|
|
$viewPath = dirname(__DIR__, 2) . '/Resources/views/livewire/ticket-show.blade.php';
|
|
$view = file_get_contents($viewPath);
|
|
|
|
self::assertIsString($view);
|
|
self::assertStringContainsString('Branch create command', $view);
|
|
self::assertStringContainsString('\'git checkout -b bugfix/\' . $ticket->reference . \'-\'', $view);
|
|
self::assertStringContainsString('data-helpdesk-branch-prefix-select', $view);
|
|
self::assertStringContainsString('$gitflowPrefixes', $view);
|
|
self::assertStringContainsString('normaliseHelpdeskBranchPrefix', $view);
|
|
self::assertStringContainsString('Commit message', $view);
|
|
self::assertStringContainsString('Pull request title', $view);
|
|
self::assertStringContainsString('data-helpdesk-copy-template', $view);
|
|
self::assertStringContainsString('data-helpdesk-copy-template-button', $view);
|
|
self::assertStringContainsString('copyHelpdeskTemplate', $view);
|
|
self::assertStringContainsString('copyTextToClipboard', $view);
|
|
}
|
|
|
|
/**
|
|
* Ensure linked Git activity still renders branch and commit badges instead of being hidden by the new panel.
|
|
*/
|
|
public function test_ticket_show_still_renders_linked_git_activity_rows(): void
|
|
{
|
|
$viewPath = dirname(__DIR__, 2) . '/Resources/views/livewire/ticket-show.blade.php';
|
|
$view = file_get_contents($viewPath);
|
|
|
|
self::assertIsString($view);
|
|
self::assertStringContainsString('@forelse ($gitActivity as $commit)', $view);
|
|
self::assertStringContainsString('$isBranchActivity = $commit->short_hash === \'branch\';', $view);
|
|
self::assertStringContainsString('{{ $isBranchActivity ? \'Branch\' : \'Commit\' }}', $view);
|
|
self::assertStringContainsString('No Git activity linked.', $view);
|
|
}
|
|
}
|