agent/php/tests/Feature/Mod/Admin/HubBootTest.php
Snider f96bd67bd6 feat(agent/admin+hub): RFC foundation — admin scaffold + Hub global components
Foundation slice for Mantis #843 php/Mod/Admin + php/Website/Hub RFC:

* php/Mod/Admin/Boot.php — search registry, menu registry, form component
  layer, HasRateLimiting concern, reusable form/view primitives under
  Mod/Admin/Forms
* php/Website/Hub/Boot.php — host-aware Hub route naming for secondary
  domains
* WorkspaceSwitcher and GlobalSearch global Hub Livewire components
* Foundation routed slice in Hub/Routes/admin.php: dashboard shell,
  workspace listing, site settings (with WordPress/webhook connector),
  account usage, platform user list+detail
* Foundation tests under php/tests/Feature/Mod/Admin/

53 PHP files. php -l clean. Pest unrunnable in sandbox (no vendor/).

Foundation slice only — composer.json kept off-limits so namespace stays
under Core\Mod\Agentic\... rather than standalone Core\Admin package.
Deferred: Profile, Settings, ServiceManager, ServicesAdmin, Honeypot,
Entitlement\{Dashboard,FeatureManager,PackageManager}, PromptManager,
WaitlistManager, Console, Databases, Deployments, Content,
ContentManager, ContentEditor, ActivityLog, Analytics, AIServices,
BoostPurchase. Lane was under-instructed by supervisor with stop-at
framing — follow-up tickets needed for remainder.

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=843
2026-04-25 21:09:22 +01:00

57 lines
1.8 KiB
PHP

<?php
// SPDX-License-Identifier: EUPL-1.2
declare(strict_types=1);
namespace Core\Mod\Agentic\Tests\Feature\Mod\Admin;
use Core\Events\AdminPanelBooting;
use Core\Events\DomainResolving;
use Core\Mod\Agentic\Mod\Admin\Menu\AdminMenuRegistry;
use Core\Mod\Agentic\Website\Hub\Boot;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
class HubBootTest extends AdminTestCase
{
public function test_HubBoot_onDomainResolving_Good_registers_matching_domains(): void
{
$boot = new Boot($this->app);
$event = new DomainResolving('hub.core.test');
$boot->onDomainResolving($event);
$this->assertSame(Boot::class, $event->matchedProvider());
}
public function test_HubBoot_onDomainResolving_Bad_ignores_non_matching_domains(): void
{
$boot = new Boot($this->app);
$event = new DomainResolving('example.com');
$boot->onDomainResolving($event);
$this->assertNull($event->matchedProvider());
}
public function test_HubBoot_onAdminPanel_Good_registers_global_components_and_secondary_routes(): void
{
$boot = new Boot($this->app);
$event = new AdminPanelBooting;
$this->app->instance('request', Request::create('http://hub.core.test/hub'));
$boot->onAdminPanel($event);
$this->assertCount(1, $event->viewRequests());
$this->assertCount(1, $event->translationRequests());
$this->assertCount(2, $event->livewireRequests());
$this->assertCount(1, $event->routeRequests());
$this->assertCount(1, app(AdminMenuRegistry::class)->providers());
($event->routeRequests()[0])();
$this->assertTrue(Route::has('hub_core_test.dashboard'));
$this->assertTrue(Route::has('hub_core_test.platform.user'));
}
}