Extracts the user profile read-view into a core service + shared partial so
modules no longer duplicate the assignment/scope logic, and migrates the
admin/users list as the drawer's second consumer.
Consolidation:
- `core/Service/User/UserProfileViewService` owns the single read-path that
resolves tenants/departments/roles for a user UUID, enforces scope-aware
department visibility, and returns a consistent `{status, user}` shape.
- `templates/partials/app-user-profile.phtml` is the shared render template;
takes `$profileKey` for storage namespace + lightbox grouping.
- `AddressBookService::buildViewContext()` shrinks to a one-line delegation
and drops its `UserAssignmentService` dependency. The old
`modules/addressbook/templates/address-book-profile.phtml` is removed.
admin/users migration:
- `pages/admin/users/view-fragment($id).php` + `(none).phtml` use the core
service and enforce `ABILITY_ADMIN_USERS_VIEW`.
- `admin-users-index.js` replaces the grid-native `linkColumn` on the first
name with a formatter that emits `data-drawer-trigger`; `linkColumn` is
disabled so the drawer click handler wins. `fullUrl` points at the edit
form — drawer → edit is one click.
- Drawer labels wired via page config.
The new `DetailDrawerFragmentContractTest` validated the users fragment
endpoint automatically — no manual test additions were needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
61 lines
3.3 KiB
PHP
61 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Tests\Architecture;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class FrontendRuntimeHostContractTest extends TestCase
|
|
{
|
|
use ProjectFileAssertionSupport;
|
|
|
|
public function testHostBoundComponentsExposeDataAppComponentMarkupHosts(): void
|
|
{
|
|
$defaultTemplate = $this->readProjectFile('templates/default.phtml');
|
|
$loginTemplate = $this->readProjectFile('templates/login.phtml');
|
|
$flashPartial = $this->readProjectFile('templates/partials/app-flash.phtml');
|
|
$topbarPartial = $this->readProjectFile('templates/partials/app-topbar.phtml');
|
|
$asideIconBar = $this->readProjectFile('templates/partials/app-main-aside-icon-bar.phtml');
|
|
$asidePartial = $this->readProjectFile('templates/partials/app-main-aside.phtml');
|
|
$bookmarkDialog = $this->readProjectFile('modules/bookmarks/templates/bookmark-dialogs.phtml');
|
|
$bookmarkPanelTemplate = $this->readProjectFile('modules/bookmarks/templates/aside-bookmarks-panel.phtml');
|
|
$sessionWarningDialog = $this->readProjectFile('templates/partials/app-session-warning-dialog.phtml');
|
|
|
|
$this->assertStringContainsString('id="page-config-app-components"', $defaultTemplate);
|
|
$this->assertStringContainsString('id="page-config-login-components"', $loginTemplate);
|
|
$this->assertStringNotContainsString("assetVersion('js/components/app-bookmark-init.js')", $defaultTemplate);
|
|
|
|
$this->assertStringContainsString('data-app-component="flash-auto-dismiss"', $flashPartial);
|
|
$this->assertStringContainsString('data-app-component="tenant-switcher"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="theme-controls"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="contrast-toggle"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="details-aside-toggle"', $topbarPartial);
|
|
$this->assertStringContainsString('data-app-component="aside-panels"', $asideIconBar);
|
|
$this->assertStringContainsString('data-app-component="sidebar-toggle"', $asidePartial);
|
|
$searchDialog = $this->readProjectFile('templates/partials/app-search-dialog.phtml');
|
|
$this->assertStringContainsString('data-app-component="global-search"', $searchDialog);
|
|
$this->assertStringContainsString('data-app-component="bookmark-panel"', $bookmarkPanelTemplate);
|
|
$this->assertStringContainsString('data-app-component="bookmark-save"', $bookmarkDialog);
|
|
$this->assertStringContainsString('data-app-component="session-warning"', $sessionWarningDialog);
|
|
}
|
|
|
|
public function testTabsHostsUseDataAppComponentContract(): void
|
|
{
|
|
$files = [
|
|
'templates/partials/app-user-profile.phtml',
|
|
'pages/admin/departments/_form.phtml',
|
|
'pages/admin/permissions/_form.phtml',
|
|
'pages/admin/roles/_form.phtml',
|
|
'pages/admin/settings/index(default).phtml',
|
|
'pages/admin/stats/index(default).phtml',
|
|
'pages/admin/tenants/_form.phtml',
|
|
'pages/admin/users/_form.phtml',
|
|
];
|
|
|
|
foreach ($files as $file) {
|
|
$content = $this->readProjectFile($file);
|
|
$this->assertStringContainsString('data-tabs', $content, $file);
|
|
$this->assertStringContainsString('data-app-component="tabs"', $content, $file);
|
|
}
|
|
}
|
|
}
|