refactor(compat): Prüfbausteine nach src/Compatibility, Matrix und ManifestCheck generisch

Requirement, Call, ConstantRequirement, Mirror, Problem, FeatureStatus, CompatibilityMatrix, Manifest, ManifestCheck sowie Fingerprints und LineDiff liegen jetzt im divi-freien Kern. Neu: GlobalRequirement, CompatibilityMatrix::fromProblems(), ManifestCheck-Option signatures, DiviManifestCheck::create() und DiviAreas. Divi-Verhalten unverändert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-11-06 12:03:30 +01:00
co-authored by Claude Opus 5.5
parent 9beb55e228
commit b511ef6348
92 changed files with 1185 additions and 636 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Compatibility;
use LIT\MCP\Compatibility\Call;
use PHPUnit\Framework\TestCase;
final class CallTest extends TestCase
{
public static function sample(int $a, int $b = 0): void
{
}
private static function method(): string
{
return self::class . '::sample';
}
public function testAcceptsAnExistingFunctionWithAMatchingArgumentCount(): void
{
self::assertTrue((new Call('strlen', 1))->accepts());
self::assertTrue((new Call('sprintf', 5))->accepts(), 'variadic');
}
public function testRejectsAnArgumentCountThePlatformFunctionDoesNotTake(): void
{
self::assertFalse((new Call('strlen', 2))->accepts(), 'strlen takes one argument');
self::assertFalse((new Call('str_replace', 2))->accepts(), 'str_replace needs three');
}
public function testNullArgumentCountOnlyChecksExistence(): void
{
self::assertTrue((new Call('str_replace'))->accepts());
}
public function testMissingFunctionOrMethodIsRejected(): void
{
self::assertFalse((new Call('lit_mcp_missing_function'))->accepts());
self::assertFalse((new Call(self::class . '::missing'))->accepts());
self::assertFalse((new Call('Lit\Missing\Klass::method'))->accepts());
}
public function testChecksTheArgumentCountOfAMethod(): void
{
self::assertTrue((new Call(self::method(), 1))->accepts());
self::assertTrue((new Call(self::method(), 2))->accepts());
self::assertFalse((new Call(self::method(), 0))->accepts(), 'one required');
self::assertFalse((new Call(self::method(), 3))->accepts(), 'at most two');
}
}