29 lines
843 B
PHP
29 lines
843 B
PHP
<?php
|
|
|
|
it('does not contain duplicate migration filenames', function (): void {
|
|
$files = array_merge(
|
|
glob(database_path('migrations/*.php')) ?: [],
|
|
glob(base_path('Modules/*/Database/Migrations/*.php')) ?: [],
|
|
);
|
|
|
|
$duplicates = collect($files)
|
|
->groupBy(fn (string $file): string => basename($file))
|
|
->filter(fn ($group): bool => $group->count() > 1)
|
|
->keys()
|
|
->values()
|
|
->all();
|
|
|
|
expect($duplicates)->toBe([]);
|
|
});
|
|
|
|
it('uses unique migration class names', function (): void {
|
|
$files = array_merge(
|
|
glob(database_path('migrations/*.php')) ?: [],
|
|
glob(base_path('Modules/*/Database/Migrations/*.php')) ?: [],
|
|
);
|
|
|
|
foreach ($files as $file) {
|
|
expect((string) file_get_contents($file))->not->toContain('class CreateMigration');
|
|
}
|
|
});
|