modified version handling
This commit is contained in:
@@ -20,10 +20,10 @@ it('version set fails when invalid version', function (): void {
|
||||
expect($exitCode)->toBe(1);
|
||||
});
|
||||
|
||||
it('version fetch fails when no version', function (): void {
|
||||
it('version fetch succeeds without db version when composer version exists', function (): void {
|
||||
Setting::where('key', 'version')->delete();
|
||||
$exitCode = \Illuminate\Support\Facades\Artisan::call('version:fetch');
|
||||
expect($exitCode)->toBe(1);
|
||||
expect($exitCode)->toBe(0);
|
||||
});
|
||||
|
||||
it('version release fails when missing config', function (): void {
|
||||
|
||||
@@ -53,13 +53,16 @@ namespace {
|
||||
|
||||
it('fetches build count and syncs composer metadata', function (): void {
|
||||
withComposerBackupForFetch(function (): void {
|
||||
Setting::updateOrCreate(['key' => 'version'], ['value' => '1.2.3']);
|
||||
Setting::updateOrCreate(['key' => 'version'], ['value' => '0.0.0']);
|
||||
$composer = json_decode((string) file_get_contents(base_path('composer.json')), true);
|
||||
$expectedVersion = (string) ($composer['version'] ?? '');
|
||||
|
||||
$exitCode = Artisan::call('version:fetch');
|
||||
expect($exitCode)->toBe(0);
|
||||
|
||||
$build = Setting::where('key', 'build')->value('value');
|
||||
expect(is_numeric($build))->toBeTrue();
|
||||
expect(Setting::where('key', 'version')->value('value'))->toBe($expectedVersion);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user