Files
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

68 lines
2.4 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\ReleaseStatus;
/**
* Release statuses for tests, built the way production builds them (ReleaseStatus::of() with a matrix): every feature
* released except the named ones, all released, or all in one state.
*/
final class ReleaseMatrices
{
/** @param list<DiviFeature> $locked */
public static function matrix(array $locked, ReleaseState $state = ReleaseState::Untested): CompatibilityMatrix
{
$features = [];
foreach (DiviFeature::cases() as $feature) {
$features[$feature->value] = in_array($feature, $locked, true)
? new FeatureStatus(
$feature,
$state,
$state === ReleaseState::Incompatible ? ['Seiten: et_x() – Signatur geändert'] : []
)
: new FeatureStatus($feature, ReleaseState::Released, [], ReleaseStatus::SOURCE_CODE);
}
return new CompatibilityMatrix(DiviFeature::cases(), $features);
}
/** @param list<DiviFeature> $locked */
public static function status(
array $locked,
ReleaseState $state = ReleaseState::Untested,
string $version = '5.3.0'
): ReleaseStatus {
return ReleaseStatus::of($version, self::matrix($locked, $state));
}
/**
* Every feature released from $source (DiviReleases::TESTED = code, ReleaseStore = database, auto).
*
* @param array<string, mixed>|null $release The database entry of a SOURCE_DATABASE release.
*/
public static function released(
string $version = '5.2.1',
string $source = ReleaseStatus::SOURCE_CODE,
?array $release = null
): ReleaseStatus {
return ReleaseStatus::of($version, CompatibilityMatrix::allReleased(DiviFeature::cases(), $source), $release);
}
/**
* Every feature in $state with $problems (an unreleased or broken Divi as a whole).
*
* @param list<string> $problems
*/
public static function uniform(ReleaseState $state, string $version = '5.3.0', array $problems = []): ReleaseStatus
{
return ReleaseStatus::of($version, CompatibilityMatrix::uniform(DiviFeature::cases(), $state, $problems));
}
}