feat: settings page with connection tab, admin notices and site health test

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 03:21:56 +02:00
co-authored by Claude Opus 5.5
parent 2674bf2ed1
commit f084c47311
11 changed files with 731 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Admin;
use Brain\Monkey\Functions;
use LIT\MCP\Admin\AdminNotices;
use LIT\MCP\Admin\ConnectionStatus;
use LIT\MCP\Tests\Unit\TestCase;
use Mockery;
final class AdminNoticesTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
Functions\stubTranslationFunctions();
}
private function status(bool $oauth, ?array $discovery, bool $https): ConnectionStatus
{
$status = Mockery::mock(ConnectionStatus::class);
$status->allows('oauthEnabled')->andReturn($oauth);
$status->allows('discovery')->with(false)->andReturn($discovery);
$status->allows('https')->andReturn($https);
return $status;
}
public function testWarnsAboutDisabledOAuthAndBrokenDiscoveryEverywhere(): void
{
$messages = (new AdminNotices($this->status(false, ['status' => 'critical'], true)))->messages(false);
self::assertCount(2, $messages);
self::assertStringContainsString('OAuth-Server ist deaktiviert', $messages[0]);
self::assertStringContainsString('/.well-known/', $messages[1]);
}
public function testHttpsHintOnlyOnTheSettingsPage(): void
{
$notices = new AdminNotices($this->status(true, null, false));
self::assertSame([], $notices->messages(false));
self::assertCount(1, $notices->messages(true));
}
}