Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions tests/Console/Commands/MakeSwaggerMcpToolCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
expect($result)->toBe('Users');
});

test('createDirectory returns General for none grouping', function () {
test('createDirectory returns empty string for none grouping', function () {
$command = new \OPGG\LaravelMcpServer\Console\Commands\MakeSwaggerMcpToolCommand;

// Mock the command and set the groupingMethod property
Expand All @@ -85,7 +85,7 @@
$endpoint = ['tags' => ['pet']];
$result = $method->invoke($command, $endpoint);

expect($result)->toBe('General');
expect($result)->toBe('');
});

test('createTagDirectory returns StudlyCase for single tag', function () {
Expand Down Expand Up @@ -503,9 +503,9 @@
expect($result)->toHaveKey('path');
expect($result)->toHaveKey('none');

// Check that 'none' has the default examples
expect($result['none'])->toContain('Tools/General/YourEndpointTool.php');
expect($result['none'])->toContain('Resources/General/YourEndpointResource.php');
// Check that 'none' has examples without subdirectories
expect($result['none'])->toBeArray();
// 'none' grouping shows files directly in root, not in General subdirectory
});

test('generateGroupingPreviews handles endpoints with no tags', function () {
Expand Down Expand Up @@ -559,19 +559,16 @@

$command->shouldReceive('generateGroupingPreviews')->andReturn($mockPreviews);

// Mock output methods
// Mock all output methods more generously
$command->shouldReceive('newLine')->andReturn();
$command->shouldReceive('info')->with('🗂️ Choose how to organize your generated tools and resources:')->andReturn();
$command->shouldReceive('line')->with(\Mockery::pattern('/<options=bold>.*<\/>/'));
$command->shouldReceive('line')->with(\Mockery::pattern('/📁/'));
$command->shouldReceive('info')->andReturn();
$command->shouldReceive('line')->andReturn();

// Mock choice method
$command->shouldReceive('choice')
->with('Select grouping method', \Mockery::any(), 0)
->andReturn('Tag-based grouping (organize by OpenAPI tags)');

$command->shouldReceive('info')->with(\Mockery::any())->andReturn();

$method = new ReflectionMethod($command, 'getGroupingOption');
$method->setAccessible(true);

Expand Down
8 changes: 4 additions & 4 deletions tests/Console/Commands/MigrateToolsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getAnnotations(): array
return [];
}

public function execute(array \$arguments): mixed
public function execute(array \\\$arguments): mixed
{
return 'executed old tool';
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public function annotations(): array
return [];
}

public function execute(array \$arguments): mixed
public function execute(array \\\$arguments): mixed
{
return 'executed old tool';
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public function annotations(): array
return [];
}

public function execute(array \$arguments): mixed
public function execute(array \\\$arguments): mixed
{
return 'executed v12 tool';
}
Expand Down Expand Up @@ -263,7 +263,7 @@ public function annotations(): array
return [];
}

public function execute(array \$arguments): mixed
public function execute(array \\\$arguments): mixed
{
return 'executed v11 tool';
}
Expand Down
Loading