Skip to content
Closed
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
4 changes: 1 addition & 3 deletions src/Install/CodeEnvironment/CodeEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ abstract class CodeEnvironment
{
public bool $useAbsolutePathForMcp = false;

public function __construct(protected readonly DetectionStrategyFactory $strategyFactory)
{
}
public function __construct(protected readonly DetectionStrategyFactory $strategyFactory) {}

abstract public function name(): string;

Expand Down
15 changes: 10 additions & 5 deletions tests/Unit/Install/CodeEnvironment/CodeEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ public function mcpConfigPath(): string
expect($environment->mcpClientName())->toBe('Test Environment');
});

test('IsAgent returns true when implements Agent interface and has agentName', function () {
test('isAgent returns true when implements Agent interface and has agentName', function () {
$agent = new TestAgent($this->strategyFactory);

expect($agent->isAgent())->toBe(true);
});

test('IsAgent returns false when does not implement Agent interface', function () {
test('isAgent returns false when does not implement Agent interface', function () {
$environment = new TestCodeEnvironment($this->strategyFactory);

expect($environment->isAgent())->toBe(false);
Expand Down Expand Up @@ -247,8 +247,8 @@ public function mcpConfigPath(): string
->once()
->with(Mockery::on(function ($command) {
return str_contains($command, 'install test-key test-command "arg1" "arg2"') &&
str_contains($command, '-e ENV1="value1"') &&
str_contains($command, '-e ENV2="value2"');
str_contains($command, '-e ENV1="value1"') &&
str_contains($command, '-e ENV2="value2"');
}))
->andReturn($mockResult);

Expand Down Expand Up @@ -361,7 +361,12 @@ public function mcpConfigPath(): string

File::shouldReceive('put')
->once()
->with(Mockery::capture($capturedPath), Mockery::capture($capturedContent))
->with('.test/mcp.json', Mockery::on(function ($json) {
$config = json_decode($json, true);

return isset($config['mcpServers']['test-key']) &&
isset($config['mcpServers']['existing']);
}))
->andReturn(true);

$result = $environment->installMcp('test-key', 'test-command', ['arg1'], ['ENV' => 'value']);
Expand Down
Loading