Add unit and feature tests for ticket processing and article management

- Implement Fake repositories and services for testing purposes.
- Create tests for Article API including creation, validation, and listing.
- Develop ProcessTicketJobFlowTest to validate ticket processing logic.
- Add QuickReplyAdminTest for creating and updating quick replies.
- Implement TicketAndArticleModelTest to ensure proper cascading deletes and credential encryption.
- Create TicketIngestionTest for ticket creation and job dispatching.
- Add TicketShowPageTest to verify rendering of quick replies and tool calls.
- Implement unit tests for ClassifierPromptBuilder, EmbeddingService, LlmJsonDecoder, QuickReplyResolver, SupportReplyService, TicketResultPayloadBuilder, TicketToolCallService, and ToolCallRequestValidator.
This commit is contained in:
SitiWeb
2026-04-30 02:10:15 +02:00
parent 39bdba2dfb
commit c94d3f85e8
36 changed files with 7445 additions and 467 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace Tests\Unit;
use App\DTOs\ArticleCandidateDTO;
use App\Services\ClassifierPromptBuilder;
use PHPUnit\Framework\TestCase;
class ClassifierPromptBuilderTest extends TestCase
{
public function test_it_builds_prompt_with_articles_notes_and_actions(): void
{
$builder = new ClassifierPromptBuilder;
$prompt = $builder->build(
'Base prompt',
'Hoe stel ik DNS in?',
[
new ArticleCandidateDTO(
articleId: 10,
title: 'DNS',
content: 'Stappen voor DNS.',
distance: 0.12,
sourceUrl: 'https://example.test/article',
note: 'Alleen gebruiken voor DNS.',
allowedActions: ['domain_inf']
),
],
'nl'
);
$this->assertStringContainsString('Base prompt', $prompt);
$this->assertStringContainsString('User language: nl', $prompt);
$this->assertStringContainsString('Allowed actions: ["domain_inf"]', $prompt);
$this->assertStringContainsString('Internal note for support assistant', $prompt);
$this->assertStringContainsString('"tool_call"', $prompt);
}
}