refactor: Divi-Boot-Schritte in DiviIntegration::boot() (Bootable) – Upgrader-Hook, Prüf-Route, CLI und Reiter „Divi“ über lit_mcp_admin_tabs; IntegrationRegistry::boot() bootet jede Integration genau einmal; Prüfseiten-Aufräumen im load-Hook statt beim Rendern

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-18 21:53:04 +02:00
co-authored by Claude Opus 5.5
parent 06148fb8c1
commit 6c59934caa
10 changed files with 293 additions and 37 deletions
@@ -6,6 +6,7 @@ namespace LIT\MCP\Tests\Unit\Integrations;
use Brain\Monkey\Functions;
use LIT\MCP\Abilities\Ability;
use LIT\MCP\Integrations\Bootable;
use LIT\MCP\Integrations\Core\CoreIntegration;
use LIT\MCP\Integrations\Divi\DiviIntegration;
use LIT\MCP\Integrations\Integration;
@@ -79,6 +80,33 @@ final class IntegrationRegistryTest extends TestCase
self::assertSame('Divi', (new DiviIntegration($schema, FakeChangeLog::forbidden()))->label());
}
/** Integration-owned boot steps run once each, in registry order, whether or not the integration is available. */
public function testBootsEveryBootableIntegrationOnce(): void
{
$booted = [];
$bootable = function (string $id, bool $available) use (&$booted): Integration {
$integration = Mockery::mock(Integration::class . ', ' . Bootable::class);
$integration->allows('id')->andReturn($id);
$integration->allows('isAvailable')->andReturn($available);
$integration->expects('abilities')->never();
$integration->expects('boot')->once()->andReturnUsing(static function () use (&$booted, $id): void {
$booted[] = $id;
});
return $integration;
};
$registry = new IntegrationRegistry(
$this->integration('core', true, []),
$bootable('divi', false),
$bootable('pods', true)
);
$registry->boot();
$registry->boot();
self::assertSame(['divi', 'pods'], $booted);
}
private function ability(string $name, bool $direct): Ability
{
$ability = Mockery::mock(Ability::class);