feat(compat): Profile, Gates und Pods über den Kompatibilitätskern

Neu: Tier, Profile, Compatibility, CapabilityLocked, CapabilityGate, CompatibilityComponent, ProvidesCompatibility, DiviProfile sowie PodsFeature, PodsCompatibility und PodsIntegration. Das CapabilityGate sperrt gesperrte und unbekannte Fähigkeits-IDs (übernimmt die Sperre unbekannter IDs vom DiviFeatureGate) und delegiert nur Divi ausdrücklich. Pods-Schema, -Lesen, -Schreiben und -Feldrechte laufen über usable(PodsFeature::…); Schreiben verlangt FieldRead und FieldWrite, damit ein Rollback keine Werte verliert. lit-site-status meldet Pods über die CompatibilityComponent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-11-06 12:26:54 +01:00
co-authored by Claude Opus 5.5
parent b511ef6348
commit c85131603b
38 changed files with 2259 additions and 135 deletions
+60
View File
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Compatibility;
use LIT\MCP\Compatibility\CompatibilityMatrix;
use LIT\MCP\Compatibility\Profile;
use LIT\MCP\Compatibility\Tier;
use LIT\MCP\Tests\Support\FakeCapability;
use LIT\MCP\Tests\Unit\TestCase;
use LogicException;
final class ProfileTest extends TestCase
{
public function testAProfileKeepsWhatItWasGiven(): void
{
$matrix = static fn (): CompatibilityMatrix => CompatibilityMatrix::allReleased([FakeCapability::Read]);
$profile = new Profile(
'fake',
'Fake Plugin',
Tier::ReleasePerVersion,
[FakeCapability::Read],
matrix: $matrix,
minVersion: '2.0'
);
self::assertSame('fake', $profile->id);
self::assertSame('Fake Plugin', $profile->label);
self::assertSame(Tier::ReleasePerVersion, $profile->tier);
self::assertSame([FakeCapability::Read], $profile->capabilities);
self::assertSame($matrix, $profile->matrix);
self::assertSame('2.0', $profile->minVersion);
self::assertSame([], $profile->manifests);
}
public function testAReleasePerVersionProfileWithoutMatrixIsAProgrammingError(): void
{
$this->expectException(LogicException::class);
$this->expectExceptionMessage('needs a matrix closure');
new Profile('fake', 'Fake', Tier::ReleasePerVersion, [FakeCapability::Read]);
}
public function testCapabilityIdsMustBeUniqueWithinAProfile(): void
{
$this->expectException(LogicException::class);
$this->expectExceptionMessage('fake-read');
new Profile('fake', 'Fake', Tier::ReportOnly, [FakeCapability::Read, FakeCapability::Read]);
}
public function testTheTiersHaveStableValues(): void
{
self::assertSame(
['report', 'lock', 'release'],
array_map(static fn (Tier $t): string => $t->value, Tier::cases())
);
}
}