- Implement GetQBCoreEventReference tool to retrieve QBCore event information. - Implement GetQBCoreFunction tool to look up QBCore functions and exports. - Enhance SearchFiveMDocs to include QBCore documentation links. - Create Blade views for displaying QBCore events and function details. - Add tests for GetQBCoreEventReference and GetQBCoreFunction tools to ensure functionality and error handling.
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Mcp\Tools\GetQBCoreFunction;
|
|
use Laravel\Mcp\Request;
|
|
|
|
it('get qbcore function returns response with content', function () {
|
|
$tool = new GetQBCoreFunction();
|
|
$request = new Request(['function_name' => 'QBCore.Functions.GetPlayer']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect($response)->not()->toBeNull();
|
|
expect($response->content())->not()->toBeNull();
|
|
});
|
|
|
|
it('get qbcore function handles unknown function', function () {
|
|
$tool = new GetQBCoreFunction();
|
|
$request = new Request(['function_name' => 'NonExistentFunction123']);
|
|
|
|
$response = $tool->handle($request);
|
|
$content = (string) $response->content();
|
|
|
|
expect($content)->toContain('not found') || expect($content)->toContain('QBCore');
|
|
});
|
|
|
|
it('get qbcore function works with shorthand names', function () {
|
|
$tool = new GetQBCoreFunction();
|
|
$request = new Request(['function_name' => 'AddMoney']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect($response)->not()->toBeNull();
|
|
expect($response->content())->not()->toBeNull();
|
|
});
|
|
|
|
it('get qbcore function supports javascript examples', function () {
|
|
$tool = new GetQBCoreFunction();
|
|
$request = new Request(['function_name' => 'AddMoney', 'language' => 'js']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect($response)->not()->toBeNull();
|
|
expect($response->content())->not()->toBeNull();
|
|
});
|