first commit

This commit is contained in:
julien
2026-03-20 22:13:41 +01:00
commit 41f8b3afb4
323 changed files with 27222 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Tests\Kernel;
use Netig\Netslim\Kernel\Runtime\Module\ModuleRegistry;
use Netig\Netslim\Kernel\Runtime\Module\ProvidesSchemaInterface;
use Netig\Netslim\Kernel\Runtime\RuntimePaths;
use PHPUnit\Framework\TestCase;
final class ModuleSchemaTest extends TestCase
{
protected function setUp(): void
{
RuntimePaths::setApplicationRoot(dirname(__DIR__, 2) . '/tests/Fixtures/Application');
ModuleRegistry::reset();
}
protected function tearDown(): void
{
RuntimePaths::resetApplicationRoot();
RuntimePaths::resetProjectRoot();
ModuleRegistry::reset();
}
public function testFeatureModulesDeclareOwnedMigrationDirectoriesAndTables(): void
{
$schemaModules = array_values(array_filter(
ModuleRegistry::modules(),
static fn (object $module): bool => $module instanceof ProvidesSchemaInterface,
));
self::assertCount(6, $schemaModules);
foreach ($schemaModules as $module) {
foreach ($module->migrationDirectories() as $directory) {
self::assertDirectoryExists($directory, $module::class . ' should expose an existing migration directory.');
self::assertNotSame([], glob(rtrim($directory, '/') . '/*.php') ?: [], $module::class . ' should expose at least one migration file.');
}
self::assertNotSame([], $module->requiredTables(), $module::class . ' should expose owned tables for readiness checks.');
}
}
public function testLegacyGlobalMigrationsDirectoryIsNoLongerUsed(): void
{
self::assertSame([], glob(dirname(__DIR__, 2) . '/database/migrations/*.php') ?: []);
}
}