1
0
Files
breadcrumb-the-shire/tests/Architecture/AuthzUiLayoutContractTest.php
fs 0e86925464 refactor: rename lib/ to core/ for clearer core-module separation
Rename the top-level lib/ directory to core/ so the project root
immediately communicates which code is core platform and which lives
in modules/. PHP namespaces (MintyPHP\*) are unchanged — only the
Composer PSR-4 path mapping moves from lib/ to core/.

Module-internal lib/ directories (modules/*/lib/) are untouched.

Updated across the full stack:
- composer.json PSR-4 mapping
- bootstrap entry points (web/index.php, bin/*, tests/bootstrap.php)
- tooling configs (phpstan.neon, phpunit.xml, php-cs-fixer)
- 26 architecture contract tests
- enforcement-policy, guard-catalog, quality-gates
- all documentation (CLAUDE.md, README, 25 docs/, .agents/skills/)
- bin/qa-extended.sh search paths
- .claude/settings.local.json permission paths

Workflow: .agents/runs/CORE-LIB-RENAME-001/ (Analyst → Planner →
Executor → Code Review (4 findings fixed) → Security Review →
Acceptance Test → Finalizer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 23:20:42 +02:00

52 lines
2.2 KiB
PHP

<?php
namespace MintyPHP\Tests\Architecture;
use PHPUnit\Framework\TestCase;
class AuthzUiLayoutContractTest extends TestCase
{
use ProjectFileAssertionSupport;
public function testLayoutPartialsUseViewAuthLayoutCapabilities(): void
{
$defaultTemplate = $this->readProjectFile('templates/default.phtml');
$this->assertStringContainsString("\$viewAuth['layout']", $defaultTemplate);
$this->assertStringNotContainsString('UiAccessService::class', $defaultTemplate);
$aside = $this->readProjectFile('templates/partials/app-main-aside.phtml');
$this->assertStringContainsString("\$viewAuth['layout']", $aside);
$this->assertStringContainsString('layoutHasAdminPanel(', $aside);
$this->assertStringContainsString('$layoutNav', $aside);
$iconBar = $this->readProjectFile('templates/partials/app-main-aside-icon-bar.phtml');
$this->assertStringContainsString("\$viewAuth['layout']", $iconBar);
$this->assertStringContainsString('layoutHasAdminPanel(', $iconBar);
}
public function testAsideTemplateDoesNotReadRequestOrResolveServicesDirectly(): void
{
$aside = $this->readProjectFile('templates/partials/app-main-aside.phtml');
$this->assertStringNotContainsString('$_GET', $aside);
$this->assertStringNotContainsString('$_SESSION', $aside);
$this->assertStringNotContainsString('TenantAvatarService', $aside);
$this->assertStringNotContainsString('app(', $aside);
}
public function testUiAccessServiceUsesCentralLayoutMapDefinition(): void
{
$content = $this->readProjectFile('core/Service/Access/UiAccessService.php');
$this->assertStringContainsString('UiCapabilityMap::LAYOUT', $content);
}
public function testCoreCapabilityMapDoesNotHardcodeAuditCapabilities(): void
{
$content = $this->readProjectFile('core/Service/Access/UiCapabilityMap.php');
$this->assertStringNotContainsString('can_view_system_audit', $content);
$this->assertStringNotContainsString('can_view_api_audit', $content);
$this->assertStringNotContainsString('can_view_user_lifecycle_audit', $content);
$this->assertStringNotContainsString('can_view_imports_audit', $content);
}
}