Add QBCore tools for player and shared data information
- Implement GetQBCorePlayers tool to retrieve player data structure, methods, events, and examples. - Implement GetQBCoreSharedData tool to retrieve shared data types including items, jobs, gangs, vehicles, weapons, starter items, and utilities. - Create corresponding Blade views for displaying player and shared data information. - Add tests for GetQBCoreConfig, GetQBCorePlayers, and GetQBCoreSharedData tools to ensure correct functionality and response handling.
This commit is contained in:
14 files changed
+1157
-6
No files matched your search
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\GetQBCoreConfig;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
test('GetQBCoreConfig returns Player config', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'Player', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Player');
|
||||
expect((string) $response->content())->toContain('PlayerDefaults');
|
||||
});
|
||||
|
||||
test('GetQBCoreConfig returns Framework config', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'Framework', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Framework');
|
||||
expect((string) $response->content())->toContain('Version');
|
||||
});
|
||||
|
||||
test('GetQBCoreConfig returns Database config', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'Database', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Database');
|
||||
expect((string) $response->content())->toContain('Backend');
|
||||
});
|
||||
|
||||
test('GetQBCoreConfig returns Callbacks config', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'Callbacks', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Callbacks');
|
||||
expect((string) $response->content())->toContain('JavaScript Example');
|
||||
});
|
||||
|
||||
test('GetQBCoreConfig returns Features config', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'Features', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Features');
|
||||
});
|
||||
|
||||
test('GetQBCoreConfig returns RepTypes config', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'RepTypes', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('RepTypes');
|
||||
expect((string) $response->content())->toContain('selling');
|
||||
});
|
||||
|
||||
test('GetQBCoreConfig returns not found for invalid type', function () {
|
||||
$tool = new GetQBCoreConfig;
|
||||
$request = new Request(['config_type' => 'InvalidType', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\GetQBCorePlayers;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
test('GetQBCorePlayers returns Structure info', function () {
|
||||
$tool = new GetQBCorePlayers;
|
||||
$request = new Request(['info_type' => 'Structure', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Structure');
|
||||
expect((string) $response->content())->toContain('PlayerData');
|
||||
expect((string) $response->content())->toContain('Functions');
|
||||
});
|
||||
|
||||
test('GetQBCorePlayers returns PlayerData info', function () {
|
||||
$tool = new GetQBCorePlayers;
|
||||
$request = new Request(['info_type' => 'PlayerData', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('PlayerData');
|
||||
expect((string) $response->content())->toContain('citizenid');
|
||||
expect((string) $response->content())->toContain('charinfo');
|
||||
});
|
||||
|
||||
test('GetQBCorePlayers returns Methods info', function () {
|
||||
$tool = new GetQBCorePlayers;
|
||||
$request = new Request(['info_type' => 'Methods', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Methods');
|
||||
expect((string) $response->content())->toContain('AddItem');
|
||||
expect((string) $response->content())->toContain('SetJob');
|
||||
});
|
||||
|
||||
test('GetQBCorePlayers returns Events info', function () {
|
||||
$tool = new GetQBCorePlayers;
|
||||
$request = new Request(['info_type' => 'Events', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Events');
|
||||
expect((string) $response->content())->toContain('JavaScript Example');
|
||||
});
|
||||
|
||||
test('GetQBCorePlayers returns Examples info', function () {
|
||||
$tool = new GetQBCorePlayers;
|
||||
$request = new Request(['info_type' => 'Examples', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Examples');
|
||||
expect((string) $response->content())->toContain('HasItem');
|
||||
});
|
||||
|
||||
test('GetQBCorePlayers returns not found for invalid type', function () {
|
||||
$tool = new GetQBCorePlayers;
|
||||
$request = new Request(['info_type' => 'InvalidType', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\GetQBCoreSharedData;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
test('GetQBCoreSharedData returns Items data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'Items', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Items');
|
||||
expect((string) $response->content())->toContain('label');
|
||||
expect((string) $response->content())->toContain('weight');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns Jobs data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'Jobs', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Jobs');
|
||||
expect((string) $response->content())->toContain('grades');
|
||||
expect((string) $response->content())->toContain('Lua Example');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns Gangs data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'Gangs', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Gangs');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns Vehicles data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'Vehicles', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Vehicles');
|
||||
expect((string) $response->content())->toContain('model');
|
||||
expect((string) $response->content())->toContain('price');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns Weapons data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'Weapons', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Weapons');
|
||||
expect((string) $response->content())->toContain('JavaScript Example');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns StarterItems data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'StarterItems', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('StarterItems');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns Utilities data', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'Utilities', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('Utilities');
|
||||
expect((string) $response->content())->toContain('RandomStr');
|
||||
expect((string) $response->content())->toContain('Trim');
|
||||
});
|
||||
|
||||
test('GetQBCoreSharedData returns not found for invalid type', function () {
|
||||
$tool = new GetQBCoreSharedData;
|
||||
$request = new Request(['data_type' => 'InvalidType', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
Reference in new issue
Block a user