Add documentation links, refactor tools, and implement new tests
- 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.
This commit is contained in:
38 files changed
+2248
-818
No files matched your search
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GenerateManifest;
|
||||
use App\Mcp\Tools\FiveM\GenerateManifest;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('generate manifest returns response with content', function () {
|
||||
$tool = new GenerateManifest();
|
||||
$tool = new GenerateManifest;
|
||||
$request = new Request(['resource_name' => 'test-resource']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
@@ -14,7 +14,7 @@ it('generate manifest returns response with content', function () {
|
||||
});
|
||||
|
||||
it('generate manifest includes required fields', function () {
|
||||
$tool = new GenerateManifest();
|
||||
$tool = new GenerateManifest;
|
||||
$request = new Request(['resource_name' => 'my-test-resource']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GenerateResourceBoilerplate;
|
||||
use App\Mcp\Tools\FiveM\GenerateResourceBoilerplate;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('generate resource boilerplate returns response with content', function () {
|
||||
$tool = new GenerateResourceBoilerplate();
|
||||
$tool = new GenerateResourceBoilerplate;
|
||||
$request = new Request(['resource_name' => 'test-resource']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
@@ -14,7 +14,7 @@ it('generate resource boilerplate returns response with content', function () {
|
||||
});
|
||||
|
||||
it('generate resource boilerplate includes resource name', function () {
|
||||
$tool = new GenerateResourceBoilerplate();
|
||||
$tool = new GenerateResourceBoilerplate;
|
||||
$request = new Request(['resource_name' => 'my-boilerplate']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GetCOXEventReference;
|
||||
use App\Mcp\Tools\COX\MySQL\GetCOXEventReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get cox event reference returns response with content', function () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GetCOXFunction;
|
||||
use App\Mcp\Tools\COX\MySQL\GetCOXFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get cox function returns response with content', function () {
|
||||
@@ -45,7 +45,7 @@ it('get cox function supports javascript examples', function () {
|
||||
|
||||
it('get cox function works with transaction methods', function () {
|
||||
$tool = new GetCOXFunction;
|
||||
$request = new Request(['function_name' => 'MySQL.transaction.begin']);
|
||||
$request = new Request(['function_name' => 'MySQL.transaction']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\FiveM\Client\GetEventClientReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns client event reference', function () {
|
||||
$tool = new GetEventClientReference;
|
||||
$request = new Request(['event_name' => 'onResourceStart']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('onResourceStart');
|
||||
});
|
||||
|
||||
it('returns not found for invalid event', function () {
|
||||
$tool = new GetEventClientReference;
|
||||
$request = new Request(['event_name' => 'InvalidEvent']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('lists all client events when empty event name', function () {
|
||||
$tool = new GetEventClientReference;
|
||||
$request = new Request(['event_name' => '']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('handles case insensitive event names', function () {
|
||||
$tool = new GetEventClientReference;
|
||||
$request = new Request(['event_name' => 'onresourcestart']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('onResourceStart');
|
||||
});
|
||||
|
||||
it('contains lua examples', function () {
|
||||
$tool = new GetEventClientReference;
|
||||
$request = new Request(['event_name' => 'onResourceStart']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GetEventReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get event reference returns response with content', function () {
|
||||
$tool = new GetEventReference();
|
||||
$request = new Request(['event_name' => 'playerSpawned']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get event reference handles unknown event', function () {
|
||||
$tool = new GetEventReference();
|
||||
$request = new Request(['event_name' => 'NonExistentEvent123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found') || expect($content)->toContain('Event');
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\FiveM\Server\GetEventServerReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns server event reference', function () {
|
||||
$tool = new GetEventServerReference;
|
||||
$request = new Request(['event_name' => 'playerConnecting']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('playerConnecting');
|
||||
});
|
||||
|
||||
it('returns not found for invalid server event', function () {
|
||||
$tool = new GetEventServerReference;
|
||||
$request = new Request(['event_name' => 'InvalidServerEvent']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('lists all server events when empty event name', function () {
|
||||
$tool = new GetEventServerReference;
|
||||
$request = new Request(['event_name' => '']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('handles case insensitive server event names', function () {
|
||||
$tool = new GetEventServerReference;
|
||||
$request = new Request(['event_name' => 'playerdropped']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('playerDropped');
|
||||
});
|
||||
|
||||
it('contains examples for server events', function () {
|
||||
$tool = new GetEventServerReference;
|
||||
$request = new Request(['event_name' => 'playerConnecting']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\COX\Inventory\Client\GetInventoryClientFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get inventory client function returns response with content', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'openInventory']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function handles unknown function', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'NonExistentFunction123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found');
|
||||
});
|
||||
|
||||
it('get inventory client function works with SearchPlayer', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'SearchPlayer']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function works with useItem', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'useItem']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function supports javascript examples', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'GetCurrentWeapon', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function works with getCurrentWeight', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'getCurrentWeight']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\COX\Inventory\Server\GetInventoryServerFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get inventory server function returns response with content', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'AddItem']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function handles unknown function', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'NonExistentFunction123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found');
|
||||
});
|
||||
|
||||
it('get inventory server function works with RemoveItem', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'RemoveItem']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function works with RegisterStash', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'RegisterStash']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function supports javascript examples', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'GetItem', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function works with SetDurability', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'SetDurability']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\FiveM\Client\GetNativeClientFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns client native function info', function () {
|
||||
$tool = new GetNativeClientFunction;
|
||||
$request = new Request(['function_name' => 'PlayerPedId', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('PlayerPedId');
|
||||
});
|
||||
|
||||
it('returns not found for invalid function', function () {
|
||||
$tool = new GetNativeClientFunction;
|
||||
$request = new Request(['function_name' => 'InvalidFunction', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('supports javascript examples', function () {
|
||||
$tool = new GetNativeClientFunction;
|
||||
$request = new Request(['function_name' => 'GetEntityCoords', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('js');
|
||||
});
|
||||
|
||||
it('handles case insensitive function names', function () {
|
||||
$tool = new GetNativeClientFunction;
|
||||
$request = new Request(['function_name' => 'playerpedid', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('PlayerPedId');
|
||||
});
|
||||
|
||||
it('lists all client functions when no name provided', function () {
|
||||
$tool = new GetNativeClientFunction;
|
||||
$request = new Request(['function_name' => '', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GetNativeFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get native function returns response with content', function () {
|
||||
$tool = new GetNativeFunction();
|
||||
$request = new Request(['function_name' => 'GetPlayerPed']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get native function finds known function', function () {
|
||||
$tool = new GetNativeFunction();
|
||||
$request = new Request(['function_name' => 'GetPlayerPed']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('GetPlayerPed') || expect($content)->toContain('player');
|
||||
});
|
||||
|
||||
it('get native function handles unknown function', function () {
|
||||
$tool = new GetNativeFunction();
|
||||
$request = new Request(['function_name' => 'UnknownFunction123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found');
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\FiveM\Server\GetNativeServerFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns server native function info', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'TriggerClientEvent', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('TriggerClientEvent');
|
||||
});
|
||||
|
||||
it('returns not found for invalid function', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'InvalidServerFunction', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('supports javascript examples for server natives', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'GetPlayerName', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('handles case insensitive server function names', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'getplayername', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('GetPlayerName');
|
||||
});
|
||||
|
||||
it('lists all server functions when no name provided', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => '', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\Client\GetQBCoreClientEventReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns qbcore client event reference', function () {
|
||||
$tool = new GetQBCoreClientEventReference;
|
||||
$request = new Request(['event_name' => 'QBCore:Client:OnPlayerLoad']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('OnPlayerLoad');
|
||||
});
|
||||
|
||||
it('returns not found for invalid client event', function () {
|
||||
$tool = new GetQBCoreClientEventReference;
|
||||
$request = new Request(['event_name' => 'InvalidClientEvent']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('lists all client events when empty event name', function () {
|
||||
$tool = new GetQBCoreClientEventReference;
|
||||
$request = new Request(['event_name' => '']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('searches by client event short names', function () {
|
||||
$tool = new GetQBCoreClientEventReference;
|
||||
$request = new Request(['event_name' => 'QBCore:Client:OnPlayerLoad']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('OnPlayerLoad');
|
||||
});
|
||||
|
||||
it('includes notification event', function () {
|
||||
$tool = new GetQBCoreClientEventReference;
|
||||
$request = new Request(['event_name' => 'QBCore:Notify']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Notify');
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\Client\GetQBCoreClientFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns qbcore client function info', function () {
|
||||
$tool = new GetQBCoreClientFunction;
|
||||
$request = new Request(['function_name' => 'QBCore.Functions.GetPlayerData', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('GetPlayerData');
|
||||
});
|
||||
|
||||
it('returns not found for invalid client function', function () {
|
||||
$tool = new GetQBCoreClientFunction;
|
||||
$request = new Request(['function_name' => 'InvalidClientFunction', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('supports javascript examples for client functions', function () {
|
||||
$tool = new GetQBCoreClientFunction;
|
||||
$request = new Request(['function_name' => 'QBCore.Commands.Add', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('handles case insensitive client function names', function () {
|
||||
$tool = new GetQBCoreClientFunction;
|
||||
$request = new Request(['function_name' => 'qbcore.functions.getplayerdata', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('GetPlayerData');
|
||||
});
|
||||
|
||||
it('includes command registration function', function () {
|
||||
$tool = new GetQBCoreClientFunction;
|
||||
$request = new Request(['function_name' => 'QBCore.Commands.Add', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\GetQBCoreEventReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get qbcore event reference returns response with content', function () {
|
||||
$tool = new GetQBCoreEventReference();
|
||||
$request = new Request(['event_name' => 'QBCore:Client:OnPlayerLoaded']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get qbcore event reference handles unknown event', function () {
|
||||
$tool = new GetQBCoreEventReference();
|
||||
$request = new Request(['event_name' => 'NonExistentQBCoreEvent123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found') || expect($content)->toContain('QBCore event');
|
||||
});
|
||||
|
||||
it('get qbcore event reference filters by category', function () {
|
||||
$tool = new GetQBCoreEventReference();
|
||||
$request = new Request(['event_category' => 'player']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
@@ -1,44 +0,0 @@
|
||||
<?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();
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\Server\GetQBCoreServerEventReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns qbcore server event reference', function () {
|
||||
$tool = new GetQBCoreServerEventReference;
|
||||
$request = new Request(['event_name' => 'QBCore:Server:PlayerLoaded']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('PlayerLoaded');
|
||||
});
|
||||
|
||||
it('returns not found for invalid server event', function () {
|
||||
$tool = new GetQBCoreServerEventReference;
|
||||
$request = new Request(['event_name' => 'InvalidServerEvent']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('lists all server events when empty event name', function () {
|
||||
$tool = new GetQBCoreServerEventReference;
|
||||
$request = new Request(['event_name' => '']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('searches by server event short names', function () {
|
||||
$tool = new GetQBCoreServerEventReference;
|
||||
$request = new Request(['event_name' => 'QBCore:Server:PlayerLoaded']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('PlayerLoaded');
|
||||
});
|
||||
|
||||
it('contains examples for server events', function () {
|
||||
$tool = new GetQBCoreServerEventReference;
|
||||
$request = new Request(['event_name' => 'QBCore:Server:playerDropped']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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');
|
||||
});
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\SearchFiveMDocs;
|
||||
use App\Mcp\Tools\FiveM\SearchFiveMDocs;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('search fivem docs returns response with content', function () {
|
||||
$tool = new SearchFiveMDocs();
|
||||
$tool = new SearchFiveMDocs;
|
||||
$request = new Request(['query' => 'networking']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
@@ -14,7 +14,7 @@ it('search fivem docs returns response with content', function () {
|
||||
});
|
||||
|
||||
it('search fivem docs handles empty results', function () {
|
||||
$tool = new SearchFiveMDocs();
|
||||
$tool = new SearchFiveMDocs;
|
||||
$request = new Request(['query' => 'nonexistent_topic_xyz']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
Reference in new issue
Block a user