release aufiting

This commit is contained in:
Mark Gregory
2026-07-24 14:04:37 +01:00
parent bc9427ac33
commit c91ac80ab6
7 changed files with 328 additions and 0 deletions
@@ -0,0 +1,16 @@
<?php
use Illuminate\Support\Facades\Blade;
it('compiles application and module blade templates', function (): void {
$views = array_merge(
glob(resource_path('views/**/*.blade.php')) ?: [],
glob(base_path('Modules/*/Resources/views/**/*.blade.php')) ?: [],
);
foreach ($views as $view) {
$compiled = Blade::compileString((string) file_get_contents($view));
expect($compiled)->toBeString()->not->toBeEmpty();
}
});
@@ -0,0 +1,28 @@
<?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');
}
});
@@ -0,0 +1,26 @@
<?php
use Illuminate\Support\Str;
it('has valid module manifests', function (): void {
$manifests = glob(base_path('Modules/*/module.json')) ?: [];
expect($manifests)->not->toBeEmpty();
foreach ($manifests as $manifest) {
$decoded = json_decode((string) file_get_contents($manifest), true, 512, JSON_THROW_ON_ERROR);
expect($decoded)
->toBeArray()
->toHaveKey('name')
->toHaveKey('providers');
expect($decoded['name'])->toBeString()->not->toBeEmpty();
expect($decoded['providers'])->toBeArray();
foreach ($decoded['providers'] as $provider) {
expect($provider)->toBeString();
expect(Str::contains($provider, '\\'))->toBeTrue();
}
}
});
@@ -0,0 +1,12 @@
<?php
use Illuminate\Support\Facades\Route;
it('does not register duplicate named routes', function (): void {
$names = collect(Route::getRoutes())
->map(fn ($route): ?string => $route->getName())
->filter()
->values();
expect($names->duplicates()->values()->all())->toBe([]);
});