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
+18
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Admin;
use Brain\Monkey\Filters;
use Brain\Monkey\Functions;
use LIT\MCP\Admin\AdminTab;
use LIT\MCP\Admin\SettingsPage;
@@ -58,6 +59,23 @@ final class SettingsPageTest extends TestCase
self::assertSame(['verbindung', 'zugriff'], $page->tabSlugs());
}
/** Integrations add their tabs in Bootable::boot() (Divi: "Divi", last); the filter runs once, on first use. */
public function testIntegrationsAppendTheirTabsThroughTheFilter(): void
{
$divi = Mockery::mock(AdminTab::class);
$divi->allows('slug')->andReturn('divi');
$divi->expects('registerActions')->once();
Filters\expectApplied(SettingsPage::TABS_FILTER)->once()->andReturnUsing(
static fn (array $tabs): array => [...$tabs, $divi]
);
$page = new SettingsPage([$this->tab('verbindung', 'Verbindung'), $this->tab('zugriff', 'Zugriff')]);
Functions\when('add_action')->justReturn(true);
$page->register();
self::assertSame(['verbindung', 'zugriff', 'divi'], $page->tabSlugs());
}
public function testRendersTheLogoTopRightOnlyWhenGiven(): void
{
Functions\when('current_user_can')->justReturn(true);