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:
co-authored by
Claude Opus 5.5
parent
b511ef6348
commit
c85131603b
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||||
|
||||
use Brain\Monkey\Functions;
|
||||
use LIT\MCP\Compatibility\ReleaseState;
|
||||
use LIT\MCP\Compatibility\Tier;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviAdapters;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviProfile;
|
||||
use LIT\MCP\Integrations\Divi\Release\ReleaseGate;
|
||||
use LIT\MCP\Tests\Support\ReleaseMatrices;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use Mockery;
|
||||
|
||||
final class DiviProfileTest extends TestCase
|
||||
{
|
||||
private function theme(string $template, string $version = '5.2.1'): void
|
||||
{
|
||||
$theme = Mockery::mock();
|
||||
$theme->allows('get_template')->andReturn($template);
|
||||
$theme->allows('parent')->andReturn(false);
|
||||
$theme->allows('get')->with('Version')->andReturn($version);
|
||||
Functions\when('wp_get_theme')->justReturn($theme);
|
||||
}
|
||||
|
||||
public function testDescribesDiviAsAReleasePerVersionPlugin(): void
|
||||
{
|
||||
$profile = DiviProfile::profile();
|
||||
|
||||
self::assertSame('divi', $profile->id);
|
||||
self::assertSame('Divi', $profile->label);
|
||||
self::assertSame(Tier::ReleasePerVersion, $profile->tier);
|
||||
self::assertSame(DiviFeature::cases(), $profile->capabilities);
|
||||
self::assertEquals(array_values(DiviAdapters::manifests()), $profile->manifests);
|
||||
}
|
||||
|
||||
public function testTheMatrixIsTheReleaseGatesMatrix(): void
|
||||
{
|
||||
$status = ReleaseMatrices::status([DiviFeature::PageWrite], ReleaseState::Incompatible);
|
||||
ReleaseGate::useResolver(static fn () => $status);
|
||||
|
||||
self::assertSame($status->matrix, (DiviProfile::profile()->matrix)());
|
||||
}
|
||||
|
||||
public function testTheVersionComesFromTheDiviTemplateAndThereIsNoActiveCheck(): void
|
||||
{
|
||||
$this->theme('Divi', '5.3.0');
|
||||
$profile = DiviProfile::profile();
|
||||
self::assertNull($profile->active, 'Divi has its own component; DiviIntegration decides availability');
|
||||
self::assertSame('5.3.0', ($profile->version)());
|
||||
|
||||
$this->theme('twentytwentyfive');
|
||||
self::assertNull(($profile->version)());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user