Files
netslim-core/tests/Architecture/ModuleStructureTest.php
2026-03-20 22:13:41 +01:00

35 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Architecture;
use Tests\Architecture\Support\ArchitectureTestCase;
final class ModuleStructureTest extends ArchitectureTestCase
{
public function testFeatureModulesUseExpectedTopLevelStructure(): void
{
foreach (self::FEATURE_MODULES as $module) {
$modulePath = $this->modulePath($module);
self::assertDirectoryExists($modulePath, $this->moduleRuleMessage(self::MESSAGE_MODULE_DIRECTORY_MISSING, $module));
$entries = array_values(array_filter(scandir($modulePath) ?: [], static fn (string $entry): bool => !in_array($entry, ['.', '..'], true)));
sort($entries);
self::assertSame($this->expectedModuleEntries($module), $entries, $this->moduleRuleMessage(self::MESSAGE_STANDARD_MODULE_STRUCTURE, $module));
}
}
public function testLegacyGlobalViewsDirectoryHasBeenRemoved(): void
{
self::assertDirectoryDoesNotExist($this->projectPath('views'));
}
public function testFixtureApplicationExposesAModuleManifest(): void
{
self::assertDirectoryExists($this->projectPath('tests/Fixtures/Application/config'));
self::assertFileExists($this->projectPath('tests/Fixtures/Application/config/modules.php'));
}
}