- Added links to QBCore and COX MySQL documentation in the main docs index. - Refactored GenerateManifest and GenerateResourceBoilerplate tools to use the correct namespaces. - Updated tests for GenerateManifest and GenerateResourceBoilerplate tools to remove unnecessary parentheses. - Refactored COX event and function tools to use the correct namespaces and updated related tests. - Introduced new tests for GetEventClientReference and GetEventServerReference tools. - Added tests for inventory client and server functions, ensuring they handle various scenarios. - Created tests for native client and server functions, including case insensitivity and example support. - Implemented QBCore client and server event/function reference tests, ensuring proper functionality and error handling. - Removed outdated tests for GetEventReference and GetQBCoreEventReference tools. - Updated SearchFiveMDocs tool to use the correct namespace and improved test coverage.
50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
use App\Mcp\Tools\QBCore\Server\GetQBCoreServerFunction;
|
|
use Laravel\Mcp\Request;
|
|
|
|
it('returns qbcore server function info', function () {
|
|
$tool = new GetQBCoreServerFunction;
|
|
$request = new Request(['function_name' => 'QBCore.Functions.GetPlayer', 'language' => 'lua']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect((string) $response->content())->toContain('GetPlayer');
|
|
});
|
|
|
|
it('returns not found for invalid server function', function () {
|
|
$tool = new GetQBCoreServerFunction;
|
|
$request = new Request(['function_name' => 'InvalidQBFunction', 'language' => 'lua']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect((string) $response->content())->toContain('not found');
|
|
});
|
|
|
|
it('supports javascript examples for server functions', function () {
|
|
$tool = new GetQBCoreServerFunction;
|
|
$request = new Request(['function_name' => 'AddMoney', 'language' => 'js']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect((string) $response->content())->not()->toBeEmpty();
|
|
});
|
|
|
|
it('handles case insensitive server function names', function () {
|
|
$tool = new GetQBCoreServerFunction;
|
|
$request = new Request(['function_name' => 'addmoney', 'language' => 'lua']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect((string) $response->content())->toContain('AddMoney');
|
|
});
|
|
|
|
it('includes player data structure', function () {
|
|
$tool = new GetQBCoreServerFunction;
|
|
$request = new Request(['function_name' => 'GetMoney', 'language' => 'lua']);
|
|
|
|
$response = $tool->handle($request);
|
|
|
|
expect((string) $response->content())->toContain('GetMoney');
|
|
});
|