Files
WP-LIT-MCP/tests/Support/DiviFeatureFixtures.php
Jan-Niclas LoosenandClaude Opus 5.5 b511ef6348 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>
2026-11-06 12:03:30 +01:00

49 lines
1.8 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Support;
use LIT\MCP\Compatibility\ReleaseState;
use LIT\MCP\Compatibility\CompatibilityMatrix;
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
use LIT\MCP\Compatibility\FeatureStatus;
use LIT\MCP\Integrations\Divi\Release\ReleaseGate;
use LIT\MCP\Integrations\Divi\Release\ReleaseStatus;
/** A release status in which single Divi capabilities are locked – for guard and tool tests. */
final class DiviFeatureFixtures
{
/**
* Makes ReleaseGate answer with $states; every capability not named is released. TestCase resets the gate.
*
* @param array<string, ReleaseState> $states DiviFeature value => state
*/
public static function useStates(array $states, string $version = '5.3.0'): void
{
$features = [];
$overall = ReleaseState::Released;
foreach (DiviFeature::cases() as $feature) {
$state = $states[$feature->value] ?? ReleaseState::Released;
$features[$feature->value] = new FeatureStatus(
$feature,
$state,
$state === ReleaseState::Released ? [] : ['Abweichung bei ' . $feature->label()],
null
);
if ($state === ReleaseState::Incompatible || ($state === ReleaseState::Untested
&& $overall === ReleaseState::Released)) {
$overall = $state;
}
}
$status = new ReleaseStatus($overall, $version, null, [], null, matrix: new CompatibilityMatrix(DiviFeature::cases(), $features));
ReleaseGate::useResolver(static fn (): ReleaseStatus => $status);
}
public static function lock(DiviFeature $feature, ReleaseState $state = ReleaseState::Untested): void
{
self::useStates([$feature->value => $state]);
}
}