feat(admin): Prüfroute je Profil und Reiter „Compatibility“
Die generische CheckRoute (POST lit-mcp/v1/<id>-check, für Divi weiter /divi-check) ersetzt DiviCheckRoute: Lock je Profil mit Besitzer-Token, Bericht je Profil, Rücksprung auf den neuen Reiter und Hook lit_mcp_compat_changed (Divi lädt darauf seinen Freigabe-Status neu). Der Reiter „Compatibility“ zeigt je Plugin Zustand (Wort und Icon), Hinweis zur Stufe, Fähigkeiten, getestete und freigegebene Versionen und den letzten Bericht, mit Prüfen, Freigeben und Zurückziehen (Recht manage_options, Allowlist der Profil-ID, Nonce je Profil). Freigeben serverseitig nur mit frischem grünem Bericht. Der Load-Hook lit_mcp_compat_profile_load bereitet den Abbau des DiviTab vor, der bis dahin parallel läuft. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7d6a97a54e
commit
85f4138b36
@@ -9,6 +9,7 @@ use Brain\Monkey\Filters;
|
||||
use Brain\Monkey\Functions;
|
||||
use LIT\MCP\Abilities\ExposurePolicy;
|
||||
use LIT\MCP\Abilities\ToolAvailability;
|
||||
use LIT\MCP\Admin\CompatibilityTab;
|
||||
use LIT\MCP\Admin\SettingsPage;
|
||||
use LIT\MCP\Compatibility\CapabilityGate;
|
||||
use LIT\MCP\Compatibility\Compatibility;
|
||||
@@ -52,11 +53,11 @@ final class PluginTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/** Only the Divi integration has boot steps; a second boot registers nothing twice. */
|
||||
/** Only the Divi integration has boot steps (upgrader hook, compat listener, tab); a second boot registers nothing twice. */
|
||||
public function testTheBootableIntegrationsBootExactlyOnce(): void
|
||||
{
|
||||
Actions\expectAdded('upgrader_process_complete')->once();
|
||||
Actions\expectAdded('rest_api_init')->once();
|
||||
Actions\expectAdded('lit_mcp_compat_changed')->once();
|
||||
Filters\expectAdded(SettingsPage::TABS_FILTER)->once();
|
||||
$registry = self::registry();
|
||||
|
||||
@@ -137,6 +138,26 @@ final class PluginTest extends TestCase
|
||||
self::assertInstanceOf(CapabilityGate::class, $guards[1]);
|
||||
}
|
||||
|
||||
/** The tab "Compatibility" gets the registry's Compatibility: one section per profile, Divi and Pods. */
|
||||
public function testTheCompatibilityTabShowsEveryProfileOfTheRegistry(): void
|
||||
{
|
||||
Functions\stubEscapeFunctions();
|
||||
Functions\stubTranslationFunctions();
|
||||
$theme = Mockery::mock();
|
||||
$theme->allows('get_template')->andReturn('twentytwentyfive');
|
||||
Functions\when('wp_get_theme')->justReturn($theme);
|
||||
$tab = Plugin::compatibilityTab(self::registry(), FakeChangeLog::forbidden());
|
||||
|
||||
ob_start();
|
||||
$tab->render();
|
||||
$html = (string) ob_get_clean();
|
||||
|
||||
self::assertInstanceOf(CompatibilityTab::class, $tab);
|
||||
self::assertSame('compatibility', $tab->slug());
|
||||
self::assertStringContainsString('id="lit-mcp-compat-divi"', $html);
|
||||
self::assertStringContainsString('id="lit-mcp-compat-pods"', $html);
|
||||
}
|
||||
|
||||
private static function readOnly(object $source): bool
|
||||
{
|
||||
return (new ReflectionProperty($source, 'readOnly'))->getValue($source);
|
||||
|
||||
Reference in New Issue
Block a user