Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace LIT\MCP\Tests\Unit\Guides;
|
||
|
||
use LIT\MCP\Guides\InstructionsBuilder;
|
||
use LIT\MCP\Integrations\Integration;
|
||
use LIT\MCP\Integrations\IntegrationRegistry;
|
||
use LIT\MCP\Tests\Unit\TestCase;
|
||
use Mockery;
|
||
|
||
final class InstructionsBuilderTest extends TestCase
|
||
{
|
||
public function testNamesActiveIntegrationsAndCoreRules(): void
|
||
{
|
||
$core = Mockery::mock(Integration::class);
|
||
$core->allows('id')->andReturn('core');
|
||
$core->allows('isAvailable')->andReturn(true);
|
||
|
||
$text = (new InstructionsBuilder(new IntegrationRegistry($core)))->build();
|
||
|
||
self::assertStringContainsString('Aktive Integrationen: core', $text);
|
||
self::assertStringContainsString('lit-guide', $text);
|
||
self::assertStringContainsString('Status', $text);
|
||
self::assertLessThan(2000, strlen($text), 'Instructions must stay short – they are loaded in every conversation.');
|
||
}
|
||
|
||
public function testListsPostTypesWhenAProviderIsGiven(): void
|
||
{
|
||
$core = Mockery::mock(Integration::class);
|
||
$core->allows('id')->andReturn('core');
|
||
$core->allows('isAvailable')->andReturn(true);
|
||
|
||
$text = (new InstructionsBuilder(new IntegrationRegistry($core), static fn (): array => ['page', 'post']))->build();
|
||
|
||
self::assertStringContainsString('Inhaltstypen: page, post', $text);
|
||
self::assertStringContainsString('lit-content-types', $text);
|
||
self::assertStringContainsString('confirm: true', $text);
|
||
}
|
||
}
|