feat: lit-guide topic all returns every guide in one call

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-27 00:44:58 +02:00
co-authored by Claude Opus 5.5
parent 788943e809
commit 858aa6a182
2 changed files with 81 additions and 2 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Core;
use Brain\Monkey\Filters;
use LIT\MCP\Guides\GuideRepository;
use LIT\MCP\Integrations\Core\GuideAbility;
use LIT\MCP\Tests\Unit\TestCase;
@@ -50,4 +51,31 @@ final class GuideAbilityTest extends TestCase
self::assertTrue($this->ability->isDirect());
self::assertTrue($this->ability->annotations()['readonly']);
}
public function testAllTopicsInOneCallOverviewFirst(): void
{
$result = $this->ability->execute(['topic' => 'all']);
self::assertSame('all', $result['topic']);
self::assertSame(['divi-shortform', 'overview'], $result['topics']);
$overview = strpos($result['content'], 'Thema `overview`');
$shortform = strpos($result['content'], 'Thema `divi-shortform`');
self::assertIsInt($overview);
self::assertIsInt($shortform);
self::assertLessThan($shortform, $overview);
self::assertStringNotContainsString('Nicht enthalten', $result['content']);
}
public function testAllTopicsStopAtTheSizeLimitAndNameTheRest(): void
{
$big = str_repeat('x', GuideAbility::ALL_LIMIT);
// Brain Monkey owns apply_filters(): answer the guide filter through its hooks API.
Filters\expectApplied('lit_mcp_guides')->andReturn(['gross' => $big]);
$ability = new GuideAbility(new GuideRepository(dirname(__DIR__, 3) . '/Fixtures/guides'));
$content = $ability->execute(['topic' => 'all'])['content'];
self::assertLessThanOrEqual(GuideAbility::ALL_LIMIT + 200, strlen($content));
self::assertStringContainsString('Nicht enthalten (Größenlimit): gross', $content);
}
}