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>
86 lines
3.1 KiB
PHP
86 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Tests\Architecture;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class BookmarksModuleIsolationContractTest extends TestCase
|
|
{
|
|
use ModuleExtractionContractSupport;
|
|
|
|
public function testCoreTemplatesHaveNoBookmarkSpecificMarkup(): void
|
|
{
|
|
$this->assertFilesDoNotContain(
|
|
[
|
|
dirname(__DIR__, 2) . '/templates/default.phtml',
|
|
dirname(__DIR__, 2) . '/templates/partials/app-topbar.phtml',
|
|
dirname(__DIR__, 2) . '/templates/partials/app-main-aside.phtml',
|
|
dirname(__DIR__, 2) . '/templates/partials/app-main-aside-icon-bar.phtml',
|
|
],
|
|
[
|
|
'aside-tab-bookmarks',
|
|
'aside-panel-bookmarks',
|
|
'data-app-bookmark-dialog',
|
|
'bookmarks.nav',
|
|
'components.bookmark',
|
|
]
|
|
);
|
|
}
|
|
|
|
public function testCoreBookmarkEntrypointsAreRemoved(): void
|
|
{
|
|
$root = dirname(__DIR__, 2);
|
|
|
|
self::assertFileDoesNotExist($root . '/templates/partials/app-bookmark-dialog.phtml');
|
|
self::assertFileDoesNotExist($root . '/web/js/components/app-bookmark-save.js');
|
|
self::assertFileDoesNotExist($root . '/web/js/components/app-bookmark-panel.js');
|
|
self::assertFileDoesNotExist($root . '/web/css/components/app-bookmark-form.css');
|
|
self::assertDirectoryDoesNotExist($root . '/pages/bookmarks');
|
|
}
|
|
|
|
public function testCoreNoLongerContainsBookmarkServiceDirectory(): void
|
|
{
|
|
$root = dirname(__DIR__, 2);
|
|
self::assertDirectoryDoesNotExist(
|
|
$root . '/core/Service/Bookmark',
|
|
'Bookmark service classes should live in modules/bookmarks/lib, not in Core lib/Service'
|
|
);
|
|
}
|
|
|
|
public function testCoreNoLongerContainsBookmarkRepositoryFiles(): void
|
|
{
|
|
$root = dirname(__DIR__, 2);
|
|
$repoDir = $root . '/core/Repository/User';
|
|
if (!is_dir($repoDir)) {
|
|
self::addToAssertionCount(1);
|
|
return;
|
|
}
|
|
|
|
$entries = scandir($repoDir) ?: [];
|
|
$bookmarkFiles = array_filter($entries, static fn (string $f): bool => str_starts_with($f, 'Bookmark'));
|
|
self::assertSame(
|
|
[],
|
|
array_values($bookmarkFiles),
|
|
'Core core/Repository/User/ still contains Bookmark files: ' . implode(', ', $bookmarkFiles)
|
|
);
|
|
}
|
|
|
|
public function testCoreNoLongerContainsBookmarkUrlNormalizer(): void
|
|
{
|
|
$root = dirname(__DIR__, 2);
|
|
self::assertFileDoesNotExist(
|
|
$root . '/core/Support/BookmarkUrlNormalizer.php',
|
|
'BookmarkUrlNormalizer should live in modules/bookmarks/lib, not in Core lib/Support'
|
|
);
|
|
}
|
|
|
|
public function testCoreAuthLifecycleHasNoLegacyBookmarkSessionKeyWrites(): void
|
|
{
|
|
$file = dirname(__DIR__, 2) . '/core/Service/Auth/AuthSessionTenantContextService.php';
|
|
$content = file_get_contents($file);
|
|
self::assertIsString($content);
|
|
self::assertStringNotContainsString('user_bookmarks', $content);
|
|
self::assertStringNotContainsString('module.bookmarks.grouped', $content);
|
|
}
|
|
}
|