Skip to content
Open
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
7 changes: 2 additions & 5 deletions src/Install/CodeEnvironment/CodeEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,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 Expand Up @@ -48,7 +46,6 @@ public function getPhpPath(): string
public function getArtisanPath(): string
{
return $this->useAbsolutePathForMcp() ? base_path('artisan') : './artisan';

}

/**
Expand Down Expand Up @@ -81,7 +78,7 @@ public function detectInProject(string $basePath): bool
return $strategy->detect($config);
}

public function IsAgent(): bool
public function isAgent(): bool
{
return $this->agentName() && $this instanceof Agent;
}
Expand Down
14 changes: 7 additions & 7 deletions tests/Unit/Install/CodeEnvironment/CodeEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ 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);
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);
expect($environment->isAgent())->toBe(false);
});

test('isMcpClient returns true when implements McpClient interface and has mcpClientName', function () {
Expand Down Expand Up @@ -259,8 +259,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 @@ -355,7 +355,7 @@ public function mcpConfigPath(): string
$config = json_decode($json, true);

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

Expand Down