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,47 @@
<?php
namespace Tests\Feature;
use App\Models\Article;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ArticleApiTest extends TestCase
{
use RefreshDatabase;
public function test_it_creates_article_with_note_and_allowed_actions(): void
{
$response = $this->postJson('/api/articles', [
'title' => 'DNS instellen',
'content' => 'Stap 1...',
'note' => 'Alleen voor DNS vragen',
'allowed_actions' => ['domain_inf'],
]);
$response->assertStatus(201);
$article = Article::query()->first();
$this->assertNotNull($article);
$this->assertSame('Alleen voor DNS vragen', $article->note);
$this->assertSame(['domain_inf'], $article->allowed_actions);
}
public function test_it_rejects_invalid_allowed_action(): void
{
$response = $this->postJson('/api/articles', [
'title' => 'DNS instellen',
'content' => 'Stap 1...',
'allowed_actions' => ['invalid_action'],
]);
$response->assertStatus(422);
}
public function test_it_lists_articles(): void
{
Article::query()->create(['title' => 'A', 'content' => 'B']);
$response = $this->getJson('/api/articles');
$response->assertOk();
}
}