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
24 changes: 9 additions & 15 deletions tests/Feature/Console/InstallCommandMultiselectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
);

// Assert that we get the keys, not the values
expect($result)->toBeArray();
expect($result)->toHaveCount(2, 'Should have 2 items selected');
expect($result)->toContain('mcp_server');
expect($result)->toContain('ai_guidelines');
expect($result)->not->toContain('Boost MCP Server');
expect($result)->not->toContain('Package AI Guidelines');
expect($result)->toBeArray()
->toHaveCount(2, 'Should have 2 items selected')
->toContain('mcp_server', 'ai_guidelines')
->not->toContain('Boost MCP Server', 'Package AI Guidelines');
})->skipOnWindows();

test('multiselect returns values for indexed array', function (): void {
Expand All @@ -48,9 +46,8 @@
);

// For indexed arrays, it returns the actual values
expect($result)->toBeArray();
expect($result)->toContain('Option 1');
expect($result)->toContain('Option 2');
expect($result)->toBeArray()
->toContain('Option 1', 'Option 2');
})->skipOnWindows();

test('multiselect behavior matches install command expectations', function (): void {
Expand Down Expand Up @@ -79,10 +76,7 @@

// Verify we get keys that can be used with in_array checks
expect($result)->toBeArray()
->and($result)->toHaveCount(3)
->and($result)->toContain('mcp_server')
->and($result)->toContain('ai_guidelines')
->and($result)->toContain('style_guidelines')
->and($result)->not->toContain('Boost MCP Server')
->and($result)->not->toContain('Package AI Guidelines (i.e. Framework, Inertia, Pest)');
->toHaveCount(3)
->toContain('mcp_server', 'ai_guidelines', 'style_guidelines')
->not->toContain('Boost MCP Server', 'Package AI Guidelines (i.e. Framework, Inertia, Pest)');
})->skipOnWindows();
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

// Should be an absolute path ending with 'artisan'
expect($artisanPath)->toEndWith('artisan')
->and($artisanPath)->not()->toBe('artisan');
->not->toBe('artisan');
});

test('Cursor returns relative php string', function (): void {
Expand All @@ -44,7 +44,7 @@

expect($cursor->getPhpPath(true))->toBe(PHP_BINARY);
expect($cursor->getArtisanPath(true))->toEndWith('artisan')
->and($cursor->getArtisanPath(true))->not()->toBe('artisan');
->not->toBe('artisan');
});

test('CodeEnvironment maintains relative paths when forceAbsolutePath is false', function (): void {
Expand All @@ -65,7 +65,7 @@

$artisanPath = $phpStorm->getArtisanPath(true);
expect($artisanPath)->toEndWith('artisan')
->and($artisanPath)->not()->toBe('artisan');
->not->toBe('artisan');

expect($phpStorm->getArtisanPath(false))->toBe($artisanPath);
});
19 changes: 11 additions & 8 deletions tests/Feature/Mcp/Tools/BrowserLogsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@

// Test that the script contains expected content
$script = BrowserLogger::getScript();
expect($script)->toContain('browser-logger-active')
->and($script)->toContain('/_boost/browser-logs')
->and($script)->toContain('console.log')
->and($script)->toContain('console.error')
->and($script)->toContain('window.onerror');

expect($script)->toContain(
'browser-logger-active',
'/_boost/browser-logs',
'console.log',
'console.error',
'window.onerror'
);
});

test('browser logs endpoint processes logs correctly', function (): void {
Expand Down Expand Up @@ -202,7 +205,7 @@

$content = $result->getContent();
expect($content)->toContain('browser-logger-active')
->and($content)->toContain('</head>')
->toContain('</head>')
// Should not inject twice
->and(substr_count($content, 'browser-logger-active'))->toBe(1);
});
Expand All @@ -219,7 +222,7 @@

$content = $result->getContent();
expect($content)->toBe($json)
->and($content)->not->toContain('browser-logger-active');
->not->toContain('browser-logger-active');
});

test('InjectBoost middleware does not inject script twice', function (): void {
Expand Down Expand Up @@ -266,5 +269,5 @@

$content = $result->getContent();
expect($content)->toContain('browser-logger-active')
->and($content)->toMatch('/<script[^>]*browser-logger-active[^>]*>.*<\/script>\s*<\/body>/s');
->toMatch('/<script[^>]*browser-logger-active[^>]*>.*<\/script>\s*<\/body>/s');
});
6 changes: 3 additions & 3 deletions tests/Feature/Mcp/Tools/ListArtisanCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
->toolHasNoError()
->toolJsonContent(function ($content): void {
expect($content)->toBeArray()
->and($content)->not->toBeEmpty();
->not->toBeEmpty();

// Check that it contains some basic Laravel commands
$commandNames = array_column($content, 'name');
expect($commandNames)->toContain('migrate')
->and($commandNames)->toContain('make:model')
->and($commandNames)->toContain('route:list');
->toContain('make:model')
->toContain('route:list');

// Check the structure of each command
foreach ($content as $command) {
Expand Down
24 changes: 13 additions & 11 deletions tests/Feature/Mcp/Tools/ListAvailableConfigKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@
->toolHasNoError()
->toolJsonContent(function ($content): void {
expect($content)->toBeArray()
->and($content)->not->toBeEmpty()
// Check that it contains common Laravel config keys
->and($content)->toContain('app.name')
->and($content)->toContain('app.env')
->and($content)->toContain('database.default')
// Check that it contains our test keys
->and($content)->toContain('test.simple')
->and($content)->toContain('test.nested.key')
->and($content)->toContain('test.array.0')
->and($content)->toContain('test.array.1');
->not->toBeEmpty()
->toContain(
// Check that it constains common Laravel config keys
'app.name',
'app.env',
'database.default',
// Check that it contains our test keys
'test.simple',
'test.nested.key',
'test.array.0',
'test.array.1'
);

// Check that keys are sorted
$sortedContent = $content;
Expand All @@ -49,6 +51,6 @@
->toolJsonContent(function ($content): void {
expect($content)->toBeArray()
// Should still have Laravel default config keys
->and($content)->toContain('app.name');
->toContain('app.name');
});
});
10 changes: 5 additions & 5 deletions tests/Feature/Mcp/Tools/ListRoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
expect($response)->isToolResult()
->toolHasNoError()
->toolTextContains('admin.dashboard', 'admin.users.store')
->and($response)->not->toolTextContains('user.profile', 'two-factor.enable');
->not->toolTextContains('user.profile', 'two-factor.enable');

$response = $tool->handle(new Request(['name' => '*two-factor*']));

expect($response)->toolTextContains('two-factor.enable')
->and($response)->not->toolTextContains('admin.dashboard', 'user.profile');
->not->toolTextContains('admin.dashboard', 'user.profile');

$response = $tool->handle(new Request(['name' => '*api*']));

expect($response)->toolTextContains('api.posts.index', 'api.posts.update')
->and($response)->not->toolTextContains('admin.dashboard', 'user.profile');
->not->toolTextContains('admin.dashboard', 'user.profile');

});

Expand All @@ -63,12 +63,12 @@
$response = $tool->handle(new Request(['method' => '*GET*']));

expect($response)->toolTextContains('admin.dashboard', 'user.profile', 'api.posts.index')
->and($response)->not->toolTextContains('admin.users.store');
->not->toolTextContains('admin.users.store');

$response = $tool->handle(new Request(['method' => '*POST*']));

expect($response)->toolTextContains('admin.users.store')
->and($response)->not->toolTextContains('admin.dashboard');
->not->toolTextContains('admin.dashboard');
});

test('it handles edge cases and empty results correctly', function (): void {
Expand Down
50 changes: 10 additions & 40 deletions tests/Unit/Install/Cli/DisplayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@
]);
$output = ob_get_clean();

expect($output)->toContain('Name')
->and($output)->toContain('Age')
->and($output)->toContain('╭')
->and($output)->toContain('╮')
->and($output)->toContain('╰')
->and($output)->toContain('╯');
expect($output)->toContain('Name', 'Age', '╭', '╮', '╰', '╯');
});

it('displays a multi-row table', function (): void {
Expand All @@ -38,12 +33,7 @@
]);
$output = ob_get_clean();

expect($output)->toContain('Name')
->and($output)->toContain('John')
->and($output)->toContain('Jane')
->and($output)->toContain('├')
->and($output)->toContain('┤')
->and($output)->toContain('┼');
expect($output)->toContain('Name', 'John', 'Jane', '├', '┤', '┼');
});

it('handles different data types in cells', function (): void {
Expand All @@ -55,11 +45,7 @@
]);
$output = ob_get_clean();

expect($output)->toContain('text')
->and($output)->toContain('123')
->and($output)->toContain('true')
->and($output)->toContain('another')
->and($output)->toContain('456');
expect($output)->toContain('text', '123', 'true', 'another', '456');
});

it('applies bold formatting to first column', function (): void {
Expand All @@ -70,8 +56,7 @@
]);
$output = ob_get_clean();

expect($output)->toContain("\e[1mHeader1\e[0m")
->and($output)->toContain("\e[1mValue1\e[0m")
expect($output)->toContain("\e[1mHeader1\e[0m", "\e[1mValue1\e[0m")
->and($output)->not->toContain("\e[1mHeader2\e[0m");
});

Expand All @@ -83,10 +68,7 @@
]);
$output = ob_get_clean();

expect($output)->toContain('名前')
->and($output)->toContain('Émile')
->and($output)->toContain('測試')
->and($output)->toContain('café');
expect($output)->toContain('名前', 'Émile', '測試', 'café');
});
});

Expand All @@ -104,51 +86,39 @@
DisplayHelper::grid(['Item1']);
$output = ob_get_clean();

expect($output)->toContain('Item1')
->and($output)->toContain('╭')
->and($output)->toContain('╮')
->and($output)->toContain('╰')
->and($output)->toContain('╯');
expect($output)->toContain('Item1', '╭', '╮', '╰', '╯');
});

it('displays multiple items in grid', function (): void {
ob_start();
DisplayHelper::grid(['Item1', 'Item2', 'Item3', 'Item4']);
$output = ob_get_clean();

expect($output)->toContain('Item1')
->and($output)->toContain('Item2')
->and($output)->toContain('Item3')
->and($output)->toContain('Item4');
expect($output)->toContain('Item1', 'Item2', 'Item3', 'Item4');
});

it('handles items of different lengths', function (): void {
ob_start();
DisplayHelper::grid(['Short', 'Very Long Item Name', 'Med']);
$output = ob_get_clean();

expect($output)->toContain('Short')
->and($output)->toContain('Very Long Item Name')
->and($output)->toContain('Med');
expect($output)->toContain('Short', 'Very Long Item Name', 'Med');
});

it('respects column width parameter', function (): void {
ob_start();
DisplayHelper::grid(['Item1', 'Item2'], 40);
$output = ob_get_clean();

expect($output)->toContain('Item1')
->and($output)->toContain('Item2');
expect($output)->toContain('Item1', 'Item2');
});

it('handles unicode characters in grid', function (): void {
ob_start();
DisplayHelper::grid(['測試', 'café', '🚀']);
$output = ob_get_clean();

expect($output)->toContain('測試')
->and($output)->toContain('café')
->and($output)->toContain('🚀');
expect($output)->toContain('測試', 'café', '🚀');
});

it('fills empty cells when items do not fill complete rows', function (): void {
Expand Down
10 changes: 6 additions & 4 deletions tests/Unit/Install/GuidelineWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,12 @@
->and($content)->toContain('updated guidelines from boost');

// Verify user content after guidelines is preserved
expect($content)->toContain('# User Added Section')
->and($content)->toContain('This content was added by the user after the guidelines.')
->and($content)->toContain('## Another user section')
->and($content)->toContain('More content here.');
expect($content)->toContain(
'# User Added Section',
'This content was added by the user after the guidelines.',
'## Another user section',
'More content here.'
);

// Verify exact structure
expect($content)->toBe("# My Project\n\n<laravel-boost-guidelines>\nupdated guidelines from boost\n</laravel-boost-guidelines>\n\n# User Added Section\nThis content was added by the user after the guidelines.\n\n## Another user section\nMore content here.\n");
Expand Down
Loading