- 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.
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Services\ToolCallRequestValidator;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ToolCallRequestValidatorTest extends TestCase
|
|
{
|
|
public function test_it_validates_domain_inf_tool_call(): void
|
|
{
|
|
$validator = new ToolCallRequestValidator;
|
|
$validated = $validator->validate([
|
|
'action' => 'domain_inf',
|
|
'parameters' => ['sld' => 'Example', 'tld' => 'NL'],
|
|
'reason' => 'Needed',
|
|
]);
|
|
|
|
$this->assertSame([
|
|
'action' => 'domain_inf',
|
|
'parameters' => ['sld' => 'example', 'tld' => 'nl'],
|
|
'reason' => 'Needed',
|
|
], $validated);
|
|
}
|
|
|
|
public function test_it_rejects_missing_parameters(): void
|
|
{
|
|
$validator = new ToolCallRequestValidator;
|
|
|
|
$this->assertNull($validator->validate([
|
|
'action' => 'domain_inf',
|
|
'parameters' => ['sld' => 'example'],
|
|
]));
|
|
}
|
|
|
|
public function test_it_rejects_unknown_action(): void
|
|
{
|
|
$validator = new ToolCallRequestValidator;
|
|
|
|
$this->assertNull($validator->validate([
|
|
'action' => 'dns_update',
|
|
'parameters' => ['sld' => 'example', 'tld' => 'nl'],
|
|
]));
|
|
}
|
|
}
|