1
0
Files
breadcrumb-the-shire/tests/Architecture/ModuleRegistryBootstrapContractTest.php
fs 5b2ea6bf27 refactor(addressbook): move from aside icon-bar to explorer nav link
Introduce generic explorer.nav_item slot type in app-main-aside.phtml
so modules can contribute links to the explorer nav panel.

Switch addressbook module from aside.tab_panel to explorer.nav_item.
Remove aside department-filter panel, AddressBookLayoutProvider, and
AddressBookSessionProvider (only served the now-removed aside panel).

Fix grid Name column overflow into Email column: CSS selector
.grid-name-cell > span:last-child never matched the <a> name link;
changed to :last-child and scoped flex-shrink:0 to :first-child only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 15:06:15 +01:00

55 lines
2.0 KiB
PHP

<?php
namespace MintyPHP\Tests\Architecture;
use MintyPHP\App\Module\ModuleRegistry;
use PHPUnit\Framework\TestCase;
final class ModuleRegistryBootstrapContractTest extends TestCase
{
public function testRegistryIsAvailableInContainer(): void
{
$registry = app(ModuleRegistry::class);
self::assertInstanceOf(ModuleRegistry::class, $registry);
}
public function testAddressBookModuleLoadsExpectedRuntimeContributions(): void
{
$modulesDir = dirname(__DIR__, 2) . '/modules';
$registry = ModuleRegistry::boot($modulesDir, ['addressbook']);
self::assertTrue($registry->hasModule('addressbook'));
self::assertNotEmpty($registry->getPermissions());
self::assertNotEmpty($registry->getSearchResources());
self::assertEmpty($registry->getLayoutContextProviders());
self::assertEmpty($registry->getSessionProviders());
self::assertNotEmpty($registry->getSlotContributions('explorer.nav_item'));
}
public function testEmptyEnvDisablesAllConfiguredModules(): void
{
$modulesDir = dirname(__DIR__, 2) . '/modules';
putenv('APP_ENABLED_MODULES=');
try {
$enabledModules = ModuleRegistry::resolveEnabledModules([
'enabled_modules' => ['addressbook', 'bookmarks'],
]);
$registry = ModuleRegistry::boot($modulesDir, $enabledModules);
} finally {
putenv('APP_ENABLED_MODULES');
}
self::assertSame([], $enabledModules, 'APP_ENABLED_MODULES empty string must disable all modules.');
self::assertSame([], $registry->getModules());
self::assertSame([], $registry->getRoutes());
self::assertSame([], $registry->getPermissions());
self::assertSame([], $registry->getSearchResources());
self::assertSame([], $registry->getLayoutContextProviders());
self::assertSame([], $registry->getSessionProviders());
self::assertSame([], $registry->getSlotContributions('aside.tab_panel'));
}
}