Add comprehensive test coverage and update notes
Some checks failed
CI/CD Pipeline / test (push) Successful in 3s
CI/CD Pipeline / deploy (push) Failing after 15s

This commit is contained in:
2026-02-08 19:04:12 +01:00
parent 160430e128
commit 88e4a70f88
43 changed files with 6114 additions and 520 deletions

View File

@@ -0,0 +1,50 @@
<?php
use App\Models\Setting;
use Illuminate\Support\Facades\Http;
it('version bump fails when no version', function (): void {
Setting::where('key', 'version')->delete();
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:bump');
expect($exitCode)->toBe(1);
});
it('version bump fails when invalid version', function (): void {
Setting::updateOrCreate(['key' => 'version'], ['value' => 'bad']);
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:bump');
expect($exitCode)->toBe(1);
});
it('version set fails when invalid version', function (): void {
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:set', ['version' => 'bad']);
expect($exitCode)->toBe(1);
});
it('version fetch fails when no version', function (): void {
Setting::where('key', 'version')->delete();
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:fetch');
expect($exitCode)->toBe(1);
});
it('version release fails when missing config', function (): void {
Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']);
putenv('GITEA_TOKEN');
putenv('GITEA_OWNER');
putenv('GITEA_REPO');
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:release');
expect($exitCode)->toBe(1);
});
it('version release handles create failure', function (): void {
Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']);
putenv('GITEA_TOKEN=token');
putenv('GITEA_OWNER=owner');
putenv('GITEA_REPO=repo');
Http::fake([
'*' => Http::response([], 500),
]);
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:release');
expect($exitCode)->toBe(1);
});